public function loginUsingId($userId)
    {
        $guard = config('autologin.guard');

        if ($user = Auth::guard($guard)->getProvider()->retrieveById($userId)) {

            Auth::guard($guard)->login($user);

            return $user;
        }

        return null;
    }
public function loginUsingId($userId)
    {
        $guard = config('autologin.guard');

        if ($user = Auth::guard($guard)->getProvider()->retrieveById($userId)) {

            Auth::guard($guard)->login($user);

            return $user;
        }

        return null;
    }
public function loginUsingId ( $ userId ) { $ guard = config ( 'autologin.guard' ) ; if ( $ user = Auth :: guard ( $ guard ) -> getProvider ( ) -> retrieveById ( $ userId ) ) { Auth :: guard ( $ guard ) -> login ( $ user ) ; return $ user ; } return null ; }
Log a user in through the Laravel Auth facade
through their user id.

@param  int  $userId
@return mixed
Log a user in through the Laravel Auth facade through their user id .