Route::group (or chained calls) attaches shared attributes to a set of routes.
Route::middleware(['auth', 'verified'])
->prefix('admin')
->name('admin.')
->group(function () {
Route::get('/', [AdminController::class, 'index'])->name('home');
Route::get('/users', [AdminController::class, 'users'])->name('users');
});
The full names become admin.home, admin.users. The URL prefix becomes /admin, /admin/users.
Middleware patterns
auth— must be logged in (redirects to/loginotherwise).verified— must have confirmed their email (redirects toverification.notice).throttle:60,1— max 60 requests/min/IP.
Subdomain routing
Route::domain('{account}.g4t.io')->group(function () {
Route::get('/', [AccountController::class, 'home']);
});
The {account} segment is injected as a parameter into every action.