I try to register user with send connfirmation mail at the samme time.but the page is reloaded there is no data stored in db and also not sending the confirmation email.
RegisterController.php 受保护的函数create(array $ data) { 返回User :: create([ 'title'=> $ data ['title'], 'fname'=> $ data ['fname'], 'lname'=> $ data ['lname'], 'company'=> $ data ['company'], 'email'=> $ data ['email'], 'phone'=> $ data ['phone'], 'people'=> $ data ['people'], 'sdate'=> $ data ['sdate'], 'notes'=> $ data ['note'], 'password'=> Hash :: make($ data ['password']), ]); } 公共功能寄存器(请求$ request) { // dd($ request-> all()); $ this-> validator($ request-> all())-> validate();
event(new Registered($user = $this->create($request->all())));
Mail::to($user->email)->send(new ConfirmationEmail($user));
return back()->with('status','Please confirm your email address...');
// $this->guard()->login($user);
// return $this->registered($request, $user)
// ?: redirect($this->redirectPath());
}
//confirmation email code
public function confirmEmail($token)
{
User::whereToken($token)->firstOrFail()->confirmEmail();
return redirect('/user/login')->with('status', 'You are now confirmed. Please login.');
}