The Hackernoon.com site has a tutorial posted from Cloudways showing you how to use the queue handling for email verification in a Laravel 5.4 application. The tutorial walks you through the updates and additions you'll need to make to the user signup process to verify their email.
Today, I will demonstrate how you can use Queue in Laravel 5.4 for email verification by using integrated auth RegisterController. In addition, I will also show you how to add the email sending process to a queue to make your app processes faster.In this article, I am going to use a database for the queue jobs. However, you can use Redis or any other drivers, as defined in the official docs.
The updates assume you've created the authentication/authorization system with Laravel's make:auth
command. Once you've run that and the code is generated you can then make the changes:
- updating the users table to store the email token
- adding a table for the queue records
- migrating the tables
- updating the
.env
file with queue and mail information
They then go through the functionality to add to the app including the EmailVerification
class, the email template and a SendVerficationEmail
queue job. The last updates are to the auth registration process to push the sending of the verification email to the background and send another email when the email is confirmed.