Javier
Javier

Reputation: 113

Laravel 5 new routes don't work

I'm starting with laravel 5 framework and I have a problem with the routes.

In the last few days, the routes worked correctly, but today I added a new route and it doesn't work anymore.

I have these routes

Route::get('url/create', 'UrlController@create');
Route::get('url/bulk', 'UrlController@bulk_view');
Route::post('url/bulk', ['as' =>'url/bulk', 'uses' => 'UrlController@bulk']);
Route::get('url/bulk_metrics', 'UrlController@bulk_metrics_view');
Route::post('url/bulk_metrics', ['as' =>'url/bulk_metrics', 'uses' => 'UrlController@bulk_metrics']);
Route::post('url/create', ['as' =>'url/create', 'uses' => 'Urlcontroller@store']);
Route::post('url/update/{id}', ['as' =>'url/update', 'uses' => 'Urlcontroller@update']);
Route::get('urls', ['as' =>'url/list', 'uses' => 'Urlcontroller@index']);
Route::get('url/{id}', ['as' =>'url/show', 'uses' => 'Urlcontroller@show']);
Route::post('url/delete/{id}', ['as' =>'url/delete', 'uses' => 'Urlcontroller@destroy']);

All work correctly, but I added this new route

Route::post('urls/filter', ['as' =>'url/filter', 'uses' => 'Urlcontroller@filter']);

and I call it like this

{!! Form::open(array('route' => 'urls/filter', 'method' => 'POST')) !!}

I tried php artisan route:clear, php artisan route:cache and php artisan route:list, and the new route appear in the list:

 POST     | urls/filter          | url/filter       | App\Http\Controllers\Urlcontroller@filter              | web,auth   |

The other routes work correctly and I think that it is a cache problem, because if I change the url/create to url/create2, and I change it in the template to url/create2 it doesn't work.

Thanks in advance to all

Upvotes: 1

Views: 432

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163968

You should use it as url/filter

{!! Form::open(array('route' => 'url/filter', 'method' => 'POST')) !!}

because you're naming it like this:

'as' =>'url/filter'

Or remove 'as' =>'url/filter' part from route. In this case name of your route will be urls/filter and not url/filter.

Upvotes: 3

Related Questions