How to Override Resource Controller Route Parameters in Laravel
In this lesson, we will see how to override resource controller route parameters in Laravel, sometimes you want to use a custom parameter for the method show or edit, so let's see how you can do that.
Give the routes a custom parameter
Let's assume that we have a product resource controller and we want to override the 'product.show' route parameter:
NB: you can do the same thing for all routes.
Route::resource('products', ProductController::class, [
'parameters' => [
'product' => 'admin_product'
]
]);