How to Override Resource Controller Route Names in Laravel
In this lesson, we will see how to override resource controller route names in Laravel, sometimes you want to give the route a custom name, so let's see how you can do that.
Give the routes a custom name
Let's assume that we have a product resource controller and we want to override the 'product.index' route name:
NB: you can do the same thing for all routes.
Route::resource('product', ProductController::class, [
'names' => [
'index' => 'admin.product.index',
'create' => 'admin.product.create',
]
]);