Biz Dev B
Biz Dev B

Reputation: 383

Laravel method get pass variable

Here is my view to search from the laravel application..

{{ Form::open(array('method' => 'get', 'url' => 'search'))}}
<input type="text" name="location" >
<input type="text" name="query" >
<input type="submit" >
{{ Form::close() }}

While i type something and press enter the page is taking me

Then My url is like this

myapp.com/search?query=abc&location=uk

How can i write the route to get the url values inside my controller ? Help pls

Upvotes: 1

Views: 424

Answers (1)

Imtiaz Pabel
Imtiaz Pabel

Reputation: 5445

For that your route will be

Route::get('/search',yourController@controllerMethod)

Then go to your defined class and write a method which you mentioned in route

public function controllerMethod(){
 dd(Request::all());
}

within the request all you will get all params data

Upvotes: 1

Related Questions