First thing ever, not ) create a route so it can get in the way and cause problems, crash routes, etc. in>. A basic example of creating this type of route would be with Route::post
(you do not have to use delete
only if it's a REST Web Api
, but for form use post
and get
that's enough.) :
Example:
Route:
Route::post('pessoas/delete', 'PessoasController@delete');
Form:
<form action="/pessoas/delete" method="POST">
<input type="hidden" name="id" value="45" />
<button type="submit">Deletar</button>
</form>
Minimum example
An example ( is a how-to tip) of routes for Controller
can follow the naming of the name controller name , method name and paramentos :
Route::get('pessoas/create', 'PessoasController@create'); // criar registro
Route::get('pessoas/edit/{id}', 'PessoasController@edit'); // editar registro
Route::get('pessoas/view/{id}', 'PessoasController@view'); // ver registro
Route::post('pessoas/store', 'PessoasController@store'); // salvar novo registro
Route::post('pessoas/update', 'PessoasController@update'); // atualizar registro
Route::post('pessoas/delete', 'PessoasController@delete'); // excluir registro
where the relation is:
-
create
uses store
for gavar log ,
-
edit
uses update
to change registry , and
-
view
uses delete
to delete the registry .
This can be simplified, it can be changed, but never use routes with a paragem and only with it, so face to face this is a error , it hinders the functioning of the site by limiting the site not to have simple route names.