Bilal Haidar Profile picture
Jul 26 โ€ข 8 tweets โ€ข 2 min read
๐ŸŒถ #Laravel Tip: If you don't like magic (like me) & want to dig more into understanding things, this thread is for you!

โœด๏ธ ๐—›๐—ผ๐˜„ ๐—จ๐˜€๐—ฒ๐—ฟ ๐—ฅ๐—ฒ๐—ด๐—ถ๐˜€๐˜๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป & ๐—ฉ๐—ฒ๐—ฟ๐—ถ๐—ณ๐˜† ๐—˜๐—บ๐—ฎ๐—ถ๐—น ๐˜„๐—ผ๐—ฟ๐—ธ ๐—ถ๐—ป ๐—Ÿ๐—ฎ๐—ฟ๐—ฎ๐˜ƒ๐—ฒ๐—น (๐—•๐—ฟ๐—ฒ๐—ฒ๐˜‡๐—ฒ)

Let's start ๐Ÿ’ช

๐Ÿงต Thread ๐Ÿงต ๐Ÿ‘‡
2/8 โœจโœจ Prerequisites โœจโœจ

๐Ÿ“ Create a new Laravel app
๐Ÿ“ Install the Breeze package. In my case, I installed the Breeze package with the option of --๐—ถ๐—ป๐—ฒ๐—ฟ๐˜๐—ถ๐—ฎ
3/8 โœจโœจ Register a new User โœจโœจ

๐Ÿ“ Implement the MustVerifyEmail on the User model
๐Ÿ“ Register a new User
๐Ÿ“ The RegisteredUserController::store dispatches the Registered event
๐Ÿ“ Event listener, SendEmailVerificationNotification sends User an email to verify
4/8 โœจโœจ User Login (without being verified) 1/4 โœจโœจ

๐Ÿ“ When a user successfully logins, the user is redirected to /๐—ฑ๐—ฎ๐˜€๐—ต๐—ฏ๐—ผ๐—ฎ๐—ฟ๐—ฑ route

The /dashboard route, defined inside ๐—ฟ๐—ผ๐˜‚๐˜๐—ฒ๐˜€\๐˜„๐—ฒ๐—ฏ.๐—ฝ๐—ต๐—ฝ file, has two route middlewares assigned: ๐—ฎ๐˜‚๐˜๐—ต & ๐˜ƒ๐—ฒ๐—ฟ๐—ถ๐—ณ๐—ถ๐—ฒ๐—ฑ
5/8 โœจโœจ User Login (without being verified) 2/4 โœจโœจ

๐Ÿ“ The 'verified' middleware refers to:

'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class

That's defined inside \๐—”๐—ฝ๐—ฝ\๐—›๐˜๐˜๐—ฝ\๐—ž๐—ฒ๐—ฟ๐—ป๐—ฒ๐—น.๐—ฝ๐—ต๐—ฝ - $routeMiddleware property
6/8 โœจโœจ User Login (without being verified) 3/4 โœจโœจ

๐Ÿ“ An un-verified user is redirected to '/dashboard' upon login.

๐Ÿ“ The user is not yet verified & because the 'verified' route middleware is assigned on '/dashboard' route, the user is redirected to '/verify-email' route
7/8 โœจโœจ User Login (without being verified) 4/4 โœจโœจ

5. At this stage, the user can request to send the verification email again or log out.
8/8 โœจโœจ The End โœจโœจ

That's it!

If you like to uncover more ๐—บ๐—ฎ๐—ด๐—ถ๐—ฐ inside Laravel just comment down your request and I will do my best to cover them in future tweets ๐Ÿ˜€

Stay tuned

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Bilal Haidar

Bilal Haidar Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(