mardi 31 juillet 2018

Laravel middleware redirecting from dashboard to login page

I have written simple code for login but when I

if (Auth::guard('admin')->attempt($credentials)) {
            //dd(Auth::guard('admin')->check());
            return redirect()->intended(route('admin.dashboard'));
 }

(when I dd(Auth::guard('admin')->check()) in this I get true on login page but when I check that on dashboard I get false in Auth::guard('admin')->check()

public function __construct()
    {

      $this->middleware('auth:admin');

    }

    public function index(Request $request)
    {

        //dd(Auth::guard('admin')->check());
        return view('admin.dashboard');
    }

I don't know why the session is being destroyed after redirecting to dashboard controller.

Please let me know any other inputs you want from my side.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2O0TWVr
via IFTTT

Aucun commentaire:

Enregistrer un commentaire