发送带有用户注册的确认邮件

时间:2019-01-07 06:32:04

标签: laravel

    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.');
        }

0 个答案:

没有答案
相关问题