Complete the code to apply the 'auth' middleware to the route.
Route::get('/dashboard', function () { return view('dashboard'); })->[1]('auth');
The middleware method attaches middleware to a route in Laravel.
Complete the code to apply multiple middleware 'auth' and 'verified' to the route.
Route::post('/profile', function () { // Update profile })->middleware([[1]]);
Multiple middleware are passed as an array of strings.
Fix the error in the middleware group definition to apply 'auth' and 'admin' middleware.
Route::middleware([1])->group(function () { Route::get('/admin', function () { // Admin dashboard }); });
Middleware groups require an array of middleware names.
Fill both blanks to define a route group with 'auth' middleware and prefix 'admin'.
Route::[1](['middleware' => '[2]', 'prefix' => 'admin'], function () { Route::get('/dashboard', function () { // Admin dashboard }); });
The group method creates a route group. The 'middleware' key sets the middleware name.
Fill all three blanks to create a route with 'auth' middleware, named 'profile.show', and URL '/profile'.
Route::get('[1]', function () { // Show profile })->middleware('[2]')->name('[3]');
The URL is '/profile', middleware is 'auth', and the route name is 'profile.show'.