private function loadPrincipalFromRememberMeCookie()
    {
        $hash = cookie('remember_me');
        if ($hash === null) {
            return;
        }

        try {
            list($id, $token) = explode('|', base64_decode($hash));
        }
        catch (Exception $e) {
            $this->deleteRememberMeCookie();
            return;
        }

        /** @var Model $user */
        $model = config('auth.model.class');
        $user  = call_user_func([$model, 'find'], $id);
        //$user = User::find($id);
        if ($user !== null && !empty($token) && $token === $user->getAttribute('remember_token')) {
            $this->setPrincipal($user->getId(), $user->getAttribute('name'), $user->getAttribute('role'));
        }
    }
private function loadPrincipalFromRememberMeCookie()
    {
        $hash = cookie('remember_me');
        if ($hash === null) {
            return;
        }

        try {
            list($id, $token) = explode('|', base64_decode($hash));
        }
        catch (Exception $e) {
            $this->deleteRememberMeCookie();
            return;
        }

        /** @var Model $user */
        $model = config('auth.model.class');
        $user  = call_user_func([$model, 'find'], $id);
        //$user = User::find($id);
        if ($user !== null && !empty($token) && $token === $user->getAttribute('remember_token')) {
            $this->setPrincipal($user->getId(), $user->getAttribute('name'), $user->getAttribute('role'));
        }
    }
private function loadPrincipalFromRememberMeCookie ( ) { $ hash = cookie ( 'remember_me' ) ; if ( $ hash === null ) { return ; } try { list ( $ id , $ token ) = explode ( '|' , base64_decode ( $ hash ) ) ; } catch ( Exception $ e ) { $ this -> deleteRememberMeCookie ( ) ; return ; } /** @var Model $user */ $ model = config ( 'auth.model.class' ) ; $ user = call_user_func ( [ $ model , 'find' ] , $ id ) ; //$user = User::find($id); if ( $ user !== null && ! empty ( $ token ) && $ token === $ user -> getAttribute ( 'remember_token' ) ) { $ this -> setPrincipal ( $ user -> getId ( ) , $ user -> getAttribute ( 'name' ) , $ user -> getAttribute ( 'role' ) ) ; } }
Read the "remember me" cookie if exist and store the principal into the session.
Read the remember me cookie if exist and store the principal into the session .