Route prefix with resource controller - Laravel 5.5

Sometimes you want to keep it grouped, so the solution is to use the parameters method.

Route::namespace('Admin\Hotel')->prefix('hotels')->name('hotels.')->group(function () {
Route::resource('/', 'HotelController')->parameters(['' => 'hotel']);
Route::resource('rooms', 'RoomController');
Route::resource('rooms/gallery', 'RoomGalleryController');
});

it's because resource method will automaticly add the prefix and the named routes with the first parameter you give, hotel in your case.

So you can do something like this :

Route::namespace('Admin\Hotel')->group(function () {
    Route::resource('hotels', 'HotelController');
});

Or, you can remove group function and directly use resource method.

Route::resource('hotels', 'Admin\Hotel\HotelController');

Or,

Route::namespace('Admin\Hotel')->group(function () {
    Route::resource('hotels', 'HotelController');
    Route::prefix('hotels')->name('hotels.')->group(function () {
        Route::resource('gallery', 'HotelGalleryController');
        Route::resource('rooms', 'RoomController');
        Route::resource('rooms/gallery', 'RoomGalleryController');
    });
});