public function addSocial(AbstractUser $socialUser, $provider)
    {
        $refreshToken = isset($socialUser->refreshToken) && $socialUser->refreshToken
            ? $socialUser->refreshToken
            : null;
        
        $token = is_null($socialUser->token)
            ? $provider
            : $socialUser->token;

        $this->socials()->create([
            'provider'      => $provider,
            'social_id'     => $socialUser->getId(),
            'email'         => $socialUser->getEmail(),
            'avatar'        => $socialUser->getAvatar(),
            'token'         => $token,
            'refresh_token' => $refreshToken,
            'expires_in'    => isset($socialUser->expiresIn) ? $socialUser->expiresIn : null,
        ]);
    }
public function addSocial(AbstractUser $socialUser, $provider)
    {
        $refreshToken = isset($socialUser->refreshToken) && $socialUser->refreshToken
            ? $socialUser->refreshToken
            : null;
        
        $token = is_null($socialUser->token)
            ? $provider
            : $socialUser->token;

        $this->socials()->create([
            'provider'      => $provider,
            'social_id'     => $socialUser->getId(),
            'email'         => $socialUser->getEmail(),
            'avatar'        => $socialUser->getAvatar(),
            'token'         => $token,
            'refresh_token' => $refreshToken,
            'expires_in'    => isset($socialUser->expiresIn) ? $socialUser->expiresIn : null,
        ]);
    }
public function addSocial ( AbstractUser $ socialUser , $ provider ) { $ refreshToken = isset ( $ socialUser -> refreshToken ) && $ socialUser -> refreshToken ? $ socialUser -> refreshToken : null ; $ token = is_null ( $ socialUser -> token ) ? $ provider : $ socialUser -> token ; $ this -> socials ( ) -> create ( [ 'provider' => $ provider , 'social_id' => $ socialUser -> getId ( ) , 'email' => $ socialUser -> getEmail ( ) , 'avatar' => $ socialUser -> getAvatar ( ) , 'token' => $ token , 'refresh_token' => $ refreshToken , 'expires_in' => isset ( $ socialUser -> expiresIn ) ? $ socialUser -> expiresIn : null , ] ) ; }
Add a social provider for a user.

@param AbstractUser $socialUser
@param              $provider
Add a social provider for a user .