Laravel Route

Example

Route::group(['namespace' => 'Backend', 'prefix' => 'admin', 'as' => 'admin.', 'middleware' => 'admin'], function () {
    /*
     * These routes need view-backend permission
     * (good if you want to allow more than one group in the backend,
     * then limit the backend features by different roles or permissions)
     *
     * Note: Administrator has all permissions so you do not have to specify the administrator role everywhere.
     * These routes can not be hit if the password is expired
     */
    include_route_files(__DIR__.'/backend/');
});

Included

use App\Http\Controllers\Backend\DashboardController;

/*
 * All route names are prefixed with 'admin.'.
 */
Route::redirect('/', '/admin/dashboard', 301);
Route::get('dashboard', [DashboardController::class, 'index'])->name('dashboard');

//Since namespace is Backend, don't need to use Backend\CategoryC here
Route::get('category', '[email protected]')->name('category.home');

Front end usage

<a class="nav-link {{ active_class(Active::checkUriPattern('admin/category')) }}" href="{{ route('admin.category.home') }}">
                            @lang('menus.backend.category.dashboard')
                        </a>