Problem with return route laravel 5


I have the following route:

Route::get('FinDraT/efectivoxpuesto/{id}/index','[email protected]');

and in the controller function I do:

 return redirect()->route('FinDraT/efectivoxpuesto/'. $id.'/index');

And I get the error that the route is not defined.

asked by Juan Pablo B 02.11.2016 в 03:36

1 answer


You are trying to redirect to a URL by means of a method that uses the names of those routes.

In your case it would be:

 return redirect('FinDraT/efectivoxpuesto/'. $id.'/index');

If you want to use the route() method, you will have to assign a name to your route (which I recommend):

Route::get('FinDraT/efectivoxpuesto/{id}/index','[email protected]')->name('miruta1');

in the controller:

return redirect()->route('miruta1', ['id' => $id]);

More information in the Laravel documentation:


answered by 02.11.2016 / 04:01