Reputation: 31
The laravel named route it makes query strings I don't want.
From the docs:
LARAVEL 5.6
accessing named route in LARAVEL generates URL with query string if i pass parameters to the second argument of the route() helper witch i don't want. i want URL parameters get passed.
My code:
Route::get('/posts/count', 'PostController@index');
route(posts.index, [count => 3]) // /posts?3
// i don't want this but i get it
route(posts.index, [count => 3]) // /posts/3
// i want this but i don't get it
Upvotes: 0
Views: 138
Reputation: 608
you should define route variable with {}
like this
Route::get('/posts/{count}', 'PostController@index');
Upvotes: 3