devnotes.

Route Groups, Prefixes, and Names

Route groups let you share attributes — middleware, prefixes, namespaces, or name prefixes — across many routes without repeating yourself.

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

Route::prefix('admin')->name('admin.')->group(function () {
    Route::get('/users', [AdminUserController::class, 'index'])->name('users.index');
    // Full URI: /admin/users, full name: admin.users.index
});

Resource routing generates all the standard CRUD routes (index, create, store, show, edit, update, destroy) with a single line:

Route::resource('posts', PostController::class);
// Or an API-only version without create/edit forms:
Route::apiResource('posts', PostController::class);

Grouping keeps routes/web.php and routes/api.php organized as an application grows, and combined with resource routes it is common to end up with only a handful of lines defining dozens of endpoints.

Laravel Route Groups and Resource Routing | DevNotes