laravel get url parameters code example

Example 1: how to get variable from url in laravel

request('variable')

Example 2: laravel get last get request

{{ url()->previous() }}

Example 3: get value mentthod get laravel

Input::get('lastName') ;
//lastName is variable in view

Example 4: laravel get all request parameters

$request->input('name');
$request->input('user.name'); // fetch from user object

Example 5: laravel url with parameters blade

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

Example 6: how to see with page reuested in laravel

$request->fullUrl()