Laravel - How to call several methods passing the same route?

0

When I pass the two ends up bugging the other and vice versa.

Example:

Route::get('/psicologo/editar/{psi_codigo}','PsicologoControlador@edit');
Route::get('/psicologo/editar/{psi_codigo}','ControladorMunicipioUf@ListaUfEditar');

How to solve?

    
asked by anonymous 19.12.2018 / 14:11

1 answer

0

You can not write the same route to two or more controller and métodos different. Each route that is configured is also unique within the project, but different from that you can write several different routes for the same controller and method, example :

This works:

Route::get('/psicologo/busca/{psi_codigo}','PsicologoControlador@edit');
Route::get('/psicologo/filter/{psi_codigo}','PsicologoControlador@edit');

Because different routes are pointed to the same controller and method.

Does not work

Route::get('/psicologo/editar/{psi_codigo}','PsicologoControlador@edit');
Route::get('/psicologo/editar/{psi_codigo}','ControladorMunicipioUf@ListaUfEditar');

Because the routes are equal (and should be unique) pointing to several controllers and methods.

In short: Each route is unique in your project, where repeating routes causes the project to only run one.

    
19.12.2018 / 14:30