How to receive GET/POST Data in Laravel 5.7

Step 1 :-

Create a basic form login.php in resource/views/ folder :-

<form action="/login" method="post">
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email"
 placeholder="Enter email" name="email">
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" 
placeholder="Enter password" name="pwd">
<div class="checkbox">
<label><input type="checkbox" name="remember"> Remember me</label>
<button type="submit" name="submit" class="btn btn-default">Submit</button>

here we are using CSRF Protection. If you want to know what is it please click here to know everything about CSRF Protection.

I assumed that you have created a Controller from where you are calling this html form and where the request will be received.

here is my controller:-

namespace App\Http\Controllers;
use Request;  
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\AdminModel
use DB;
class AdminController extends Controller
public function index()
return view('test');
public function login() { $req = request()->post(); print_r($req); } }

In config/app.php we can define the request method to load and the we can simple use “use Request” to initiate the request method.

there are lots of way to do this. In the above method we have use request method we can also use input method here is the details one by one

Method 1 : using request

use request // or we can use ‘Illuminate\Support\Facades\Request’ if not alredy define in config/app.php

public function login()


$r = request()->only(array('email','pwd'));


Method 2 : Using  Request class

use Request; 

public function login ()


$r = Request::all();  post()/get()/only(array()) etc..



Method 3 Using Input Method 

use Input;  //before class 
public function login()
$r = Input::post(); post()/get()/only(array()) etc..
print_r($r); } ?>

Please comment below if you are facing any problem