auth = $auth; $this->registrar = $registrar; $this->middleware('guest', ['except' => 'getLogout']); } /** * Handle a registration request for the application. * * @param Request $request * * @return \Illuminate\Http\Response */ public function postRegister(Request $request) { $validator = $this->registrar->validator($request->all()); if ($validator->fails()) { $this->throwValidationException( $request, $validator ); } $data = $request->all(); $data['password'] = bcrypt($data['password']); $this->auth->login($this->registrar->create($data)); // get the email address $email = $this->auth->user()->email; // send email. Mail::send( 'emails.registered', [], function (Message $message) use ($email) { $message->to($email, $email)->subject('Welcome to Firefly III!'); } ); // set flash message Session::flash('success', 'You have registered successfully!'); return redirect($this->redirectPath()); } }