app/Http/Controllers/SocialAuthController.php
/**
     * Callback From Google
     * @param  SocialAccountService $service [description]
     * @return Response
     */
Callback From Google
@param  SocialAccountService $service [description]
@return Response
Callback From Google @param SocialAccountService $service [ description ] @return Response
public function callbackGoogle(SocialAccountService $service)
    {
        $providerUser = Socialite::driver('google')->user();
        $user = $service->getUser($providerUser, 'google');
        if (!is_null($user)) {
            auth()->login($user);
            return redirect()->to('/app');
        } else {            
            $account = new SocialAccount([
                'provider_user_id' => $providerUser->getId(),
                'provider' => 'google'
            ]);
            $user = User::create([
                'email' => $providerUser->getEmail(),
                'name' => $providerUser->getName(),
                'photo' => $providerUser->avatar,
                'password' => str_random(10)
            ]);
            $account->user()->associate($user);
            $account->save();
            auth()->login($user);
            return redirect()->to('/app');
        }
    }
public function callbackGoogle ( SocialAccountService $ service ) { $ providerUser = Socialite :: driver ( 'google' ) -> user ( ) ; $ user = $ service -> getUser ( $ providerUser , 'google' ) ; if ( ! is_null ( $ user ) ) { auth ( ) -> login ( $ user ) ; return redirect ( ) -> to ( '/app' ) ; } else { $ account = new SocialAccount ( [ 'provider_user_id' => $ providerUser -> getId ( ) , 'provider' => 'google' ] ) ; $ user = User :: create ( [ 'email' => $ providerUser -> getEmail ( ) , 'name' => $ providerUser -> getName ( ) , 'photo' => $ providerUser -> avatar , 'password' => str_random ( 10 ) ] ) ; $ account -> user ( ) -> associate ( $ user ) ; $ account -> save ( ) ; auth ( ) -> login ( $ user ) ; return redirect ( ) -> to ( '/app' ) ; } }
Callback From Google
 @param  SocialAccountService $service [description]
 @return Response
Callback From Google @param SocialAccountService $service [ description ] @return Response