Passing page URL parameter to controller in Laravel 5.2

女生的网名这么多〃 提交于 2019-12-04 13:50:22
Achraf Khouadja

If you want to access the data sent from get or post request use

public function store(Request $request)
{
    $order = $request->input('order');
    $type = $request->input('type');
    return view('whatever')->with('order', $order)->with('type', $type);
}

you can also use wildcards.

Exemple link

website.dev/user/potato

Route

Route::put('user/{name}', 'UserController@show');

Controller

public function update( $name)
{
    User::where('name', $name)->first();
    return view('test')->with('user', $user);
}

Check the Laravel Docs Requests.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!