如何在不需要auth的情况下设置主页(laravel)
主页可以访问(并着陆)。
我正在尝试设置
use App\Http\Controllers\HomeController;
Route::get('/', [HomeController::class, 'home']->withoutMiddleware(['auth']));
每个用户在登录后将其路由到其他页面之前的标准主页,该标准 是在尝试访问home.blade.php
页面时尝试绕过Auth的要求,但是我会收到以下错误:
>因此,任何帮助将不胜感激。干杯!
I am trying to setup a standard homepage that every user has access to (and lands on), before they are routed to other pages after logging in.
Currently the web.php
setup is
use App\Http\Controllers\HomeController;
Route::get('/', [HomeController::class, 'home']->withoutMiddleware(['auth']));
The withoutMiddleware
is to try and bypass the requirement of auth when trying to access the home.blade.php
page, however I get the following error:
Very new to Laravel, so any help would be greatly appreciated. Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
路由不需要身份验证,除非它在路由
Web.php
文件或控制器中明确指定。因此,它可以如下:
Routes don't require authentication unless it's explicitly specified in the routes
web.php
file or the controller.So it can be as following: