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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire