Route::get('home/{home}', 'HomeController@home');
Is for passing with a parameter
Route::get('home', 'HomeController@home');
Is what you need
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This had been an issue for me trying to understand
I got this route
Route::get('home/{home}', 'HomeController@home');
And this action
public function home(Request $request){
return $request->input('home');
}
Why I can't grab the {home} params that way.
I KNOW its possible to declare it thought the function params like: function home($home) / or access it like $request->home,
but the documentation say that $request->get() / $request->input() access any params $_GET or $_POST
Using the Route
Route::get('home/{home}', 'HomeController@home');
You can access the {home} paramter in the controlller by
public function home(Request $request, $home){
return $home;
}
That parameter is passed to your controller method. You don't even need that Request $request param unless you're accessing get/post params. That is NOT a get or post parameter. It's not the same as http://laravel.app/home?home=value.
It is a wildcard parameter for things like http://laravel.app/home/the-white-house
Please or to participate in this conversation.