src/Authentication/MetaUser.php
public function masqueradeAsUser($user) {
        // if this user is authenticated, then we can masquerade as the
        // user that has been passed as the parameter
        if(Auth::check()) {
            // write the authenticated user into the session and then
            // authenticate as the passed user instance
            session(['masquerading_user' => Auth::user()]);
            Auth::logout();
            Auth::login($user);

            // success!
            return true;
        }

        return false;
    }
public function masqueradeAsUser($user) {
        // if this user is authenticated, then we can masquerade as the
        // user that has been passed as the parameter
        if(Auth::check()) {
            // write the authenticated user into the session and then
            // authenticate as the passed user instance
            session(['masquerading_user' => Auth::user()]);
            Auth::logout();
            Auth::login($user);

            // success!
            return true;
        }

        return false;
    }
public function masqueradeAsUser ( $ user ) { // if this user is authenticated, then we can masquerade as the // user that has been passed as the parameter if ( Auth :: check ( ) ) { // write the authenticated user into the session and then // authenticate as the passed user instance session ( [ 'masquerading_user' => Auth :: user ( ) ] ) ; Auth :: logout ( ) ; Auth :: login ( $ user ) ; // success! return true ; } return false ; }
Allows a logged-in user to masquerade as the passed User. Returns true
on success or false otherwise.

@param MetaUser $user The user instance to become
@return boolean
Allows a logged - in user to masquerade as the passed User . Returns true on success or false otherwise .