Classified
1 year ago

Route parameter does not get passed to controller

Posted 1 year ago by Classified

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' => '[email protected]',
    '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.

Please sign in or create an account to participate in this conversation.