I prescribe in routs such code for 'middleware' => ['web'] , does not work. Are there any other options to deny access to the page for guests?
Route::get('/page', function () { return redirect('404'); }); Use auth middleware to close access for guests, if you want to close access for authorized users, use guest middleware , for example like this:
Route::get('/', ['middleware' => ['auth'], function () { // }]); First option:
Route::get('profile', function () { })->middleware('auth'); The second option in the controller constructor:
public function __construct() { $this->middleware('auth'); } Source: https://ru.stackoverflow.com/questions/641304/
All Articles