Answer the question
In order to leave comments, you need to log in
Why doesn't Route::middleware('auth')->group() work?
I'm trying to make the simplest example so that the page is available only for authorized users or redirects to authorization.
Here is the TestsController controller
<?php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class TestsController extends Controller
{
public function index()
{
dd('closed page');
}
}
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::middleware('auth')->group(function () {
Route::get('/home', '[email protected]')->name('home');
Route::get('secret', 'Admin\[email protected]');
});
Answer the question
In order to leave comments, you need to log in
because
Route::group([
'middleware' => 'auth',
], function () {
Route::get('/home', '[email protected]')->name('home');
Route::get('secret', 'Admin\[email protected]');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question