public function test(Request $request, $item)
{
dd($item);
}
Sep 28, 2018
7
Level 1
Route parameter does not get passed to controller
Hello,
I am trying to pass a route parameter to a controller and for some reason it is omitted from the request object. The input fields from the form are passed to the controller with no issue, but the route parameter itself is the only thing that is omitted.
Route code
Route::post('/item/{item}/test', [
'uses' => 'ItemController@test',
'as' => 'item.test',
])->where('item', '[0-9]+');
protected function test() {
return request()->item; // returns null
}
The ID of the item is visible within the link.
Level 11
2 likes
Please or to participate in this conversation.