2
我可以成功作为用户登录,但它仍然以guest身份接收身份验证。我无法注销或登录,因为它会将我重定向到主页。我使用内置的身份验证前期的users.The唯一的文件我已经改变了与此有关的问题是路由文件laravel身份验证总是客人
Route::get('/', function() {
// return view('welcome');
if (Auth::check()) {
return Auth::user();
}
else
{
return 'guest';
}
});
Route::group(['middleware' => ['web']], function() {
// Authentication routes...
Route::get('auth/login', 'Auth\[email protected]');
Route::post('auth/login', 'Auth\[email protected]');
// Registration routes...
Route::get('auth/register', 'Auth\[email protected]');
Route::post('auth/register', 'Auth\[email protected]');
Route::get('auth/logout', 'Auth\[email protected]');
});
将您的“/”路线移动到网络中间件。 – Alen
谢谢你的工作。 –