I have a Laravel 9 project and I have added this resource route:
Route::resource('users', UsersController::class);
So it basically takes the uri which is users
and make the other route names like this:
users.index
, users.create
, users.store
, etc
Now I need to put the resource in a route group with prefix of users
, so the resource will be looked like this:
Route::prefix('users')->group(function () {
Route::resource('/', UsersController::class);
});
Now because the uri for the resource route is empty, it can not add route names.
So I wonder how can I apply a custom name for the resource route in this situation.
I tried adding Route::resource('/', UsersController::class)->name('users');
but this is wrong!
What is the proper way of applying custom route name for a resource route?