/**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     //        dd($hasCode);
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider));
     if (!$user) {
         Session::flash('message', "Something went wrong!");
         Session::flash('alert-class', 'error');
     }
     $this->auth->login($user, true);
     //        event(new \App\Events\UserEvent($user->full_name));
     return $listener->userHasBeenRegistered($user);
 }
 /**
  * @param $hasCode
  * @param $listener
  * @param $social_provider
  * @return mixed
  */
 public function execute($hasCode, AuthenticateUserListener $listener, $social_provider)
 {
     if (!$hasCode) {
         return $this->getAuthorizationFirst($social_provider);
     }
     $user = $this->users->findByEmailOrCreate($this->getSocialUser($social_provider), $this->ip);
     if (!$user) {
         Session::flash('message', "Something went wrong!");
         Session::flash('alert-class', 'error');
     } else {
         if ($user == 'user exist') {
             return redirect()->route('home');
         }
     }
     return $listener->userHasBeenRegistered($user);
 }