So, when you define a resource controller in a group group submenu of a group route, like this:
Route::group(array('domain' => '{subdomain}.example.com'), function() {
Route::resource('users', 'UserController');
});
in RouteServiceProvider
$router->model('user', 'App\User');
and in the display method of UserController:
public function show($user)
{
return $user;
}
what I get is the subdomain name instead of the user resource. This is because the parameter subdomainis passed to the controller methods, and I would have to change them as follows:
public function show($subdomain, $user)
{
return $user;
}
I just don't want to add a subdomain parameter to every controller method in my application, because I will not do anything with it. I am using the subdomain parameter in middleware to make some configuration changes.
How can I do this so that the subdomain is not passed to the controllers as a parameter?