app/Http/Controllers/SocialAuthController.php
/**
     * Callback From Facebook
     * @param  SocialAccountService $service
     * @return Response
     */
Callback From Facebook
@param  SocialAccountService $service
@return Response
Callback From Facebook @param SocialAccountService $service @return Response
public function callbackFacebook(SocialAccountService $service)
    {
        $providerUser = Socialite::driver('facebook')->fields([
            'first_name', 'last_name', 'email', 'gender', 'birthday', 'location'
        ])->user();
        $user = $service->getUser($providerUser, 'facebook');
        if (!is_null($user)) { 
            if($user->deleted_at == null) {
                auth()->login($user);
                return redirect()->to('/app'); 
            } else {
                $user->deleted_at = null;
                $user->save();
                auth()->login($user);
                return redirect()->to('/app');
            }
        } else {            
            $account = new SocialAccount([
                'provider_user_id' => $providerUser->getId(),
                'provider' => 'facebook'
            ]);
            $user = User::create([
                'email' => $providerUser->getEmail(),
                'name' => $providerUser->user['first_name'],
                'gender' => $providerUser->user['gender'],
                'photo' => $providerUser->avatar,
                'password' => str_random(10)
            ]);
            $account->user()->associate($user);
            $account->save();
            auth()->login($user);
            return redirect()->to('/app');
        }
    }
public function callbackFacebook ( SocialAccountService $ service ) { $ providerUser = Socialite :: driver ( 'facebook' ) -> fields ( [ 'first_name' , 'last_name' , 'email' , 'gender' , 'birthday' , 'location' ] ) -> user ( ) ; $ user = $ service -> getUser ( $ providerUser , 'facebook' ) ; if ( ! is_null ( $ user ) ) { if ( $ user -> deleted_at == null ) { auth ( ) -> login ( $ user ) ; return redirect ( ) -> to ( '/app' ) ; } else { $ user -> deleted_at = null ; $ user -> save ( ) ; auth ( ) -> login ( $ user ) ; return redirect ( ) -> to ( '/app' ) ; } } else { $ account = new SocialAccount ( [ 'provider_user_id' => $ providerUser -> getId ( ) , 'provider' => 'facebook' ] ) ; $ user = User :: create ( [ 'email' => $ providerUser -> getEmail ( ) , 'name' => $ providerUser -> user [ 'first_name' ] , 'gender' => $ providerUser -> user [ 'gender' ] , 'photo' => $ providerUser -> avatar , 'password' => str_random ( 10 ) ] ) ; $ account -> user ( ) -> associate ( $ user ) ; $ account -> save ( ) ; auth ( ) -> login ( $ user ) ; return redirect ( ) -> to ( '/app' ) ; } }
Callback From Facebook
 @param  SocialAccountService $service
 @return Response
Callback From Facebook @param SocialAccountService $service @return Response