Reputation: 269
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!
Upvotes: 0
Views: 4579
Reputation: 9171
Try this:
public function search($category, $keyword)
or this:
public function search(Request $request, $category, $keyword)
If you need the Request object.
The route parameters are injected in the funcion call, they are not in the request inputs.
Upvotes: 1