src/Components/AlternateAuth.php
protected function createShadowUser($userInfo)
    {
        $email = filter_var(array_get($userInfo, $this->emailField), FILTER_SANITIZE_EMAIL);
        if (empty($email)) {
            throw new InternalServerErrorException(
                'Failed to retrieve alternate user\'s email address using field ' . $this->emailField . '.'
            );
        }

        $dfUser = User::whereEmail($email)->first();
        if (empty($dfUser)) {
            $altUser = [
                'email'      => $email,
                'first_name' => 'Alternate',
                'last_name'  => 'User',
                'name'       => 'Alternate User'
            ];
            $dfUser = User::create($altUser);
        }

        return $dfUser;
    }
protected function createShadowUser($userInfo)
    {
        $email = filter_var(array_get($userInfo, $this->emailField), FILTER_SANITIZE_EMAIL);
        if (empty($email)) {
            throw new InternalServerErrorException(
                'Failed to retrieve alternate user\'s email address using field ' . $this->emailField . '.'
            );
        }

        $dfUser = User::whereEmail($email)->first();
        if (empty($dfUser)) {
            $altUser = [
                'email'      => $email,
                'first_name' => 'Alternate',
                'last_name'  => 'User',
                'name'       => 'Alternate User'
            ];
            $dfUser = User::create($altUser);
        }

        return $dfUser;
    }
protected function createShadowUser ( $ userInfo ) { $ email = filter_var ( array_get ( $ userInfo , $ this -> emailField ) , FILTER_SANITIZE_EMAIL ) ; if ( empty ( $ email ) ) { throw new InternalServerErrorException ( 'Failed to retrieve alternate user\'s email address using field ' . $ this -> emailField . '.' ) ; } $ dfUser = User :: whereEmail ( $ email ) -> first ( ) ; if ( empty ( $ dfUser ) ) { $ altUser = [ 'email' => $ email , 'first_name' => 'Alternate' , 'last_name' => 'User' , 'name' => 'Alternate User' ] ; $ dfUser = User :: create ( $ altUser ) ; } return $ dfUser ; }
Creates the shadow user if needed

@param array $userInfo

@return \DreamFactory\Core\Models\BaseModel|\Illuminate\Database\Eloquent\Model|null|static
@throws \DreamFactory\Core\Exceptions\InternalServerErrorException
@throws \Exception
Creates the shadow user if needed