BillRiess
222
12
Laravel

Remove route param from being passed to controller.

Posted 4 months ago by BillRiess

routes/api.php

Route::prefix('v1/clients/{client}')->middleware('auth:api')->group(function () {
    Route::apiResource('patrons', 'Api\PatronController');
});

app/Http/Controllers/Api/PatronController.php

...

public function update(UpdatePatron $request, $ONE, $TWO)
{
    ...
}

...

In my controller the {client} from the route and the {patron} are both being passed to the PatronController. $ONE=client_id and $TWO=patron_id. Is there a way to only pass {patron} and not the {client}? In my case, I have no need for the client_id and would prefer to not have the unused variable in my controller.

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

Reply to

Use Markdown with GitHub-flavored code blocks.