-
Notifications
You must be signed in to change notification settings - Fork 93
Auth Verify Page
verify.blade.php
is a Laravel Blade template for handling email verification features in your application. This template contains both the front-end structure of the page and the backend verification logic.
<?php
use Illuminate\Auth\Events\Verified;
use Illuminate\Support\Facades\Auth;
use function Laravel\Folio\{middleware};
middleware(['auth', 'throttle:6,1']);
$resend = function(){
$user = auth()->user();
if ($user->hasVerifiedEmail()) {
redirect('/');
}
$user->sendEmailVerificationNotification();
event(new Verified($user));
$this->dispatch('resent');
session()->flash('resent');
}
?>
-
Imported Libraries: The code starts by importing the necessary libraries and functions.
-
Illuminate\Auth\Events\Verified
: This imports theVerified
event provided by Laravel's Auth library. -
Illuminate\Support\Facades\Auth
: The auth facade is used to get the authenticated user. -
Laravel\Folio\{middleware}
: This imports the middleware function from the Laravel Folio package.
-
-
Middleware: The code uses middleware for authentication (
auth
) and throttling (throttle:6,1
), which limits requests to 6 per minute. -
Resend Function:
$resend
is a closure that handles the resending of email verification notifications. If the user's email is already verified, they are redirected to the homepage. If not, a new verification email is sent.
The Blade template consists of the HTML structure of the email verification page. It includes the logo, a prompt to verify the user's email, a sign out link, a success alert box that appears after a verification email is resent, and the actual content of the email verification instruction.
-
<x-layouts.app>
: This is a Blade component for the layout of the app. -
<x-ui.link ...>
: This component is for creating links. -
<x-ui.logo ...>
: This component is for displaying the logo. -
<x-ui.text-link ...>
: This component creates text links. -
@volt('auth.verify')
: This injects templates dynamically.
The Blade template uses the Tailwind CSS framework for styling. For example, the class text-gray-700
makes the text color gray, text-center
makes the text aligned to the center, and sm:mx-auto
applies horizontal margin auto on small screens.
This documentation should help you understand the structure and functionality of the verify.blade.php
file in your Laravel application. 🚀