laravel get url parameters in blade code example

Example 1: how to get variable from url in laravel

request('variable')

Example 2: laravel url with parameters blade

url('path') . '?' . http_build_query(['param1' => 'value', 'param2' => 'value']);

Example 3: laravel get url parameters in controller

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

Example 4: laravel get url parameters in controller

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

Tags:

Php Example