Wednesday, March 15, 2017

How to get Route URL param in Controller | Laravel

I have the following route:

Route::get('/category/{category}/keyword/{keyword}', 'CategoryController@search');

In my controller I am trying to retrieve both the URL params using the following code:

public function search(Request $request)
{
    $request->all();
    ...
}

The above code doesn't return the value of parameters.

If I call the following code, I get the value:

$request->category

Can someone tell me what am I doing wrong?

Thanks!



via Rishab

Advertisement