Today we will learn how to make an e-mail confirmation after registering in Laravel, as well as add our own event to send notifications.
laravelemail # laravel # cutcode
-------------------------------------------------- -------------------------------
❗️❗️❗️How to make complex sites in laravel? It's easy with cutcode!
Support my project - https://cutcode.ru/
Buy me coffee - buymeacoffee.com/cutcode
🤖🤖🤖My assistant Taylor is ready to give you a present. Pick up here - https://cutcode.ru/chat-bot
-------------------------------------------------- -------------------------------
⏰ Timecodes:
00:00 Introduction
01:18 A bit of theory. Laravel Documentation on Email Verification
05:53 Practice. Configuring the recording of sending messages to the log file
06:40 Add User Interface Model and Events
08:03 Setting up logic in the controller
09:40 Create email confirmation view
11:40 Create a second route with email confirmation
13:30 Customization
15:15 First check and debug
18:20 Setting up middlewars
21:02 Adding your event. Notifications from the current Eloquent object
I welcome everyone to the Cutcode channel and today's lesson was asked by a subscriber with the nickname Al Capone to write down how to make an e-mail confirmation after registration. Well, you know, I couldn't refuse a person with the nickname Al Capone. And besides, of course, thanks for the advice on the topic of the lesson. The topic is interesting, I think many will be interested in it, and therefore today I am filming a lesson about it.
We will go a little in a non-standard way, we will not send real notifications, we will do it through log files, at the same time we will play with it. Many do not know how it works, so for many it will be interesting. Since you can send real e-mail notifications in the sixth lesson on Laravel from scratch - I will add the link in the description. There we substituted the driver for you to send e-mail notifications and already sent real messages. That is, today nothing will change, we will just look at the e-mail message in the log file.
Let's quickly go over the Laravel documentation for confirmation email. There is a separate section about this, we will quickly go through all the points with which we have to work and then we will go to practice and do all the same but with a living example.
So where to start. Firstly, we need to add the verify e-mail interface to the Eloquent user model, it is not there by default, but it is available in the users, it needs to be added to the Eloquent model. After that, we will have to twitch event registered, which is also in Laravel by default. It has also been added to the event service provider, we only need to add it to the place where we will register the user, after which all the magic will already begin. Next, you need to make sure that we have a users table and it has an e-mail field EmailVerifiedAt, but by default we have the users table when installing Laravel and it has this field in it, so if you are working with fresh Laravel, when you migrate you won't have any problems with that. Further as for the routes. The most important part responsible for the functionality, we need to have three routes - the first of them is the Verification notification route, which we just show to the view to which there will be a text that you need to confirm the e-mail, and let's say it is possible to send the email again if suddenly something went wrong and the letter did not arrive. Next, the route that already performs the verification logic, that is, Laravel send an e-mail to the user as usual with a button that, when navigating, will confirm the email and just the handler for this url that will be the button here it is this route, it will look like this - we have forms request email verification request which if its validation passes, then we will execute the fulfill method, which inside will simply change that the user's current email is verified.
-------------------------------------------------- -------------------------------
📹 share this video with your friends:
• E-mail верификация пользователя, отпр...
🔔 subscribe to the YouTube channel: / @cutcoderu
📼 Laravel course from scratch:
• Курс по Laravel 8 обучение с нуля. Бе...
User email verification, sending email notifications in Laravel 8
-------------------------------------------------- -------------------------------
🔗 our website: https://cutcode.ru/
📷 our instagram: / cutcoderu
Watch video User email verification, sending email notifications in Laravel 8 online without registration, duration hours minute second in high quality. This video was added by user Просто о Laravel. CutCode 30 August 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,452 once and liked it 135 people.