Laravel

Laravel Route Groups and Prefixes

January 16, 2026 1 min read 27 views

Route organization:

Route Groups

Route::middleware(['auth'])->group(function () {
    Route::get('/dashboard', DashboardController::class);
});

Prefix

Route::prefix('admin')->group(function () {
    Route::get('/users', [AdminController::class, 'users']);
});

Name Prefix

Route::name('admin.')->group(function () {
    Route::get('/users', ...)->name('users');
});

Combined

Route::prefix('api/v1')
    ->middleware('api')
    ->name('api.v1.')
    ->group(function () {
        // Routes
    });
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!