laravel get request parameters code example

Example 1: laravel get input from request

public function store(Request $request)
    {
        $name = $request->input('name');

        //
    }

Example 2: laravel get parameters from request

request()->all() // All parameters
request()->get('param') // One parameter
request()->only('param1', 'param2') // Specific parameters

Example 3: how get some parameter from request in laravel

$data = $request->only(
            'project_name',
            'project_code',
            'block_count',
            'unit_count',
            'contractor_name',
   );

Example 4: laravel get query parameters

$name = $request->query('name', 'Helen');

Example 5: public function store(Request $request)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UserController extends Controller
{
    /**
     * Store a new user.
     *
     * @param  Request  $request
     * @return Response
     */
    public function store(Request $request)
    {
        $name = $request->input('name');

        //
    }
}

Example 6: get value mentthod get laravel

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