/** * Process the user's details * * @return [type] [description] */ public function handleProviderCallback() { // SocialAuth::login('facebook', function ($user, $userDetial) { // $user->name = $userDetial->full_name; // $user->save(); // }); $this->SocialAuth->login('facebook', function ($user, $userDetial) { $user->name = $userDetial->full_name; $user->save(); }); return redirect('worker-dashboard'); }
/** * Handle the command. * * @param AuthenticateUserCommand $command * @return void */ public function handle(AuthenticateUserCommand $command) { $user = $this->repo->findByEmail($command->email); if ($user) { if (Hash::check($command->password, $user->password)) { if (!$user->isBanned()) { //redirect if is a worker if ($user->isWorker()) { $this->auth->login($user); flash('You welcome'); return redirect('worker-dashboard'); } //redirect if is a leader if ($user->isLeader()) { $this->auth->login($user); flash('You welcome'); return redirect('leader-dashboard'); } } flash('You are banned'); return redirect()->back(); } } }