0

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
SirPeople
  • 4,248
  • 26
  • 46

1 Answers1

3

you should define route variable with {}

like this

Route::get('/posts/{count}', 'PostController@index');
Abdi
  • 589
  • 5
  • 16