Php 为什么在我登录后刷新页面时Laravel会注销?

Php 为什么在我登录后刷新页面时Laravel会注销?,php,laravel,authentication,laravel-7,Php,Laravel,Authentication,Laravel 7,谢谢大家。我解决了这个问题。问题的根源 <a class="dropdown-item" href="{{ Auth::logout() }}">Çıkış Yap</a> 家庭控制器 web.php 还有这个layout.app.blade页面 @guest @终客 @认证 @endauth 我希望你明白我的意思。我正在登录,是的,菜单工作正常。但当页面刷新时,它似乎已注销。您正在第二秒内调用href中的Auth::logout() @endauth 检查此链接这是

谢谢大家。我解决了这个问题。问题的根源

<a class="dropdown-item" href="{{ Auth::logout() }}">Çıkış Yap</a>
家庭控制器

web.php

还有这个layout.app.blade页面

@guest
@终客
@认证
@endauth

我希望你明白我的意思。我正在登录,是的,菜单工作正常。但当页面刷新时,它似乎已注销。

您正在第二秒内调用
href
中的
Auth::logout()
@endauth
检查此链接这是旧版本的Laravel。我现在使用的是7版本。默认设置。我知道,但您可以在
app/config
class LoginController extends Controller
{

    use AuthenticatesUsers;

    protected $redirectTo = RouteServiceProvider::HOME;

    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }
}
/**
 * Create a new controller instance.
 *
 * @return void
 */
public function __construct()
{
    //$this->middleware('auth');
}

/**
 * Show the application dashboard.
 *
 * @return \Illuminate\Contracts\Support\Renderable
 */
public function index()
{
    return view('home');
}
Auth::routes();

Route::get('/', 'HomeController@index')->name('home');
@guest
    <a class="dropdown-item" href="{{ route('login') }}">Giriş Yap</a>
    <a class="dropdown-item" href="{{ route('register') }}">Hizmet Ver</a>
@endguest

@auth
    <a class="dropdown-item" href="#">Profilim</a>
    <a class="dropdown-item" href="{{ Auth::logout() }}">Çıkış Yap</a>
@endauth
@auth
    <a class="dropdown-item" href="#">Profilim</a>
    <a class="dropdown-item" href="{{ route('logout') }}">Çıkış Yap</a>
@endauth