middleware('guest', ['except' => 'getLogout']); $this->socialAuthService = $socialAuthService; } /** * Get a validator for an incoming registration request. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6', ]); } /** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), ]); } /** * Show the application login form. * * @return \Illuminate\Http\Response */ public function getLogin() { if (view()->exists('auth.authenticate')) { return view('auth.authenticate'); } $socialDrivers = $this->socialAuthService->getActiveDrivers(); return view('auth.login', ['socialDrivers' => $socialDrivers]); } /** * Redirect to the relevant social site. * @param $socialDriver * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function getSocialLogin($socialDriver) { return $this->socialAuthService->logIn($socialDriver); } /** * The callback for social login services. * * @param $socialDriver * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @throws UserNotFound */ public function socialCallback($socialDriver) { $user = $this->socialAuthService->getUserFromCallback($socialDriver); \Auth::login($user, true); return redirect($this->redirectPath); } }