php - Laravel 5.4 AUTH - Auth::guard('admin')->user() After logging in, other pages are taken out as NULL
伊谢尔伦
伊谢尔伦 2017-05-16 13:14:29
0
3
967

Use

when logging in
Auth::guard('admin')->attempt([])

Returns true, then prints it with dd

dd(Auth::guard('admin'))

Login to this page is possible. Then when jumping to other pages, print again

At this time, because the user attribute is empty, so

Auth::guard('admin')->user() == null
Auth::guard('admin')->check() == false

Excuse me which step is wrong

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
巴扎黑

Check whether the session_domain setting is correct

我想大声告诉你

Both pages are directly dd?

Directly dd after logging in, resulting in no session being written.

我想大声告诉你

Have you included cookies in your redirect page? . . You didn’t add it to Kernel.php

        \App\Http\Middleware\EncryptCookies::class,
        \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
        \App\Http\Middleware\VerifyCsrfToken::class,
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
        \App\Http\Middleware\RedirectIfAuthenticated::class,
        
        类似的中间件
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!