protected function getUser($socialUser)
    {
        $user = $this->users
            ->where('email', $socialUser->getEmail())
            ->orWhereHas('socials', function ($query) use ($socialUser) {
                $query->where('email', $socialUser->getEmail())
                    ->where('provider', $this->provider->driver);
            })->first();

        if (! is_null($user)) {
            return $user;
        }

        return app(Registration::class)
            ->registerSocialUser($socialUser, $this->provider->driver);
    }
protected function getUser($socialUser)
    {
        $user = $this->users
            ->where('email', $socialUser->getEmail())
            ->orWhereHas('socials', function ($query) use ($socialUser) {
                $query->where('email', $socialUser->getEmail())
                    ->where('provider', $this->provider->driver);
            })->first();

        if (! is_null($user)) {
            return $user;
        }

        return app(Registration::class)
            ->registerSocialUser($socialUser, $this->provider->driver);
    }
protected function getUser ( $ socialUser ) { $ user = $ this -> users -> where ( 'email' , $ socialUser -> getEmail ( ) ) -> orWhereHas ( 'socials' , function ( $ query ) use ( $ socialUser ) { $ query -> where ( 'email' , $ socialUser -> getEmail ( ) ) -> where ( 'provider' , $ this -> provider -> driver ) ; } ) -> first ( ) ; if ( ! is_null ( $ user ) ) { return $ user ; } return app ( Registration :: class ) -> registerSocialUser ( $ socialUser , $ this -> provider -> driver ) ; }
Make sure that we have a valid user to work with.

@param null|\Laravel\Socialite\AbstractUser $socialUser

@return \App\Models\User
Make sure that we have a valid user to work with .