I use the form below to send the id of the line to be deleted in the table:
<form method="DELETE" action="{{ URL::to('receitas/delete') }}" >
<input type="hidden" name="id" value="{{ $receita->id }}" >
<button type="submit" class="button-deletar" ></button>
</form>
My controller has the following function:
public function getDestroy($id){
// delete
$receita = Receita::find($id);
$receita->delete();
// SALVANDO LOG
$logger = Helper::salvaLog("receitas",$id,"exclusao");
// redirect
Session::flash('message', 'Receita excluída com sucesso!');
return Redirect::to('receitas');
}
Routing looks like this:
Route::controller('receitas', 'ReceitaController');
Route::delete('receitas/{id}', ReceitaController@getDestroy );
Why does page 404 not found ( local/receitas/7
) return?