Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MAIL_DRIVER=smtp
- MAIL_HOST=smtp.mailtrap.io
- MAIL_PORT=2525
- MAIL_USERNAME=username
- MAIL_PASSWORD=password
- MAIL_ENCRYPTION=
- public function register(Request $request)
- {
- $this->validator($request->all())->validate();
- event(new Registered($user = $this->create($request->all())));
- dispatch(new SendVerificationEmail($user));
- return view('verification');
- // $this->guard()->login($user);
- // return $this->registered($request, $user)
- // ?: redirect($this->redirectPath());
- }
- public function verify($token)
- {
- $user = User::where('email_token',$token)->first();
- $user->verified = 1;
- if($user->save())
- {
- return view('emailconfirm',['user'=>$user]);
- }
- }
- class EmailVerification extends Mailable
- {
- use Queueable, SerializesModels;
- /**
- * Create a new message instance.
- *
- * @return void
- */
- protected $user;
- public function __construct($user)
- {
- //
- $this->user = $user;
- }
- /**
- * Build the message.
- *
- * @return $this
- */
- public function build()
- {
- return $this->view('email.email')->with([
- 'email_token'=> $this->user->email_token,
- ]);
- }
- }
- class SendVerificationEmail implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- /**
- * Create a new job instance.
- *
- * @return void
- */
- protected $user;
- public function __construct($user)
- {
- //
- $this->user = $user;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- //
- $email = new EmailVerification($this->user);
- Mail::to($this->user->email)->send($email);
- }
- }
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
- [2017-10-06 12:05:52] Processing: AppJobsSendVerificationEmail
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement