Problem with return route laravel 5

1

I have the following route:

Route::get('FinDraT/efectivoxpuesto/{id}/index','EfectivoxPuestoController@index');

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
source

1 answer

3

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','EfectivoxPuestoController@index')->name('miruta1');

in the controller:

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

More information in the Laravel documentation:

link

    
answered by 02.11.2016 / 04:01
source