src/Concerns/InteractsWithAuthentication.php
public function loginAs($userId, $guard = null)
    {
        $userId = method_exists($userId, 'getKey') ? $userId->getKey() : $userId;

        return $this->visit(rtrim('/_dusk/login/'.$userId.'/'.$guard, '/'));
    }
public function loginAs($userId, $guard = null)
    {
        $userId = method_exists($userId, 'getKey') ? $userId->getKey() : $userId;

        return $this->visit(rtrim('/_dusk/login/'.$userId.'/'.$guard, '/'));
    }
public function loginAs ( $ userId , $ guard = null ) { $ userId = method_exists ( $ userId , 'getKey' ) ? $ userId -> getKey ( ) : $ userId ; return $ this -> visit ( rtrim ( '/_dusk/login/' . $ userId . '/' . $ guard , '/' ) ) ; }
Log into the application using a given user ID or email.

@param  object|string  $userId
@param  string         $guard
@return $this
Log into the application using a given user ID or email .