Search This Blog

Thursday, November 9

How to get POST request variables in laravel

Take a look at the $_GET and $_REQUEST superglobals. Something like the following would work for your example:

$start = $_GET['start'];
$limit = $_GET['limit'];


1. This is one way to get the POST request variables

use class on your controller method

 The incoming request instance will automatically be injected by the service container:

 use Illuminate\Http\Request; 

$start = $request->input('start');
$limit = $request->input('limit');

see also : https://laravel.com/docs/5.5/requests#accessing-the-request

2. The another way to get the POST request variables

you need to use Input::get(), e.g.,

use class on your controller method 

 use Illuminate\Support\Facades\Input;

$start = Input::get('start');
$limit = Input::get('limit');




 

No comments:

Post a Comment