简体   繁体   中英

Getting wrong route variable value in laravel subdomain route

I am using this laravel route

Route::group(['domain' => '{subdomain}.abc.com'], function()
{
    Route::get('get_user/{user_id}','MyController@myMethod');
}

Here , I am getting wrong user_id in my controller, It should be something like 15 but I am getting my subdomain value subdomain_value

What I am doing wrong here ?

Thanks for your time and advise.

Try following code in your controller

 $user_id = $request->route()->parameter('user_id');

You can access the exact value of route variable from the route parameters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM