This set of components was designed to simplify the user authentication process in your Laravel application. The installation process is straightforward, allowing you to set up these essential features with just a few steps.
Once installed, all Livewire components and associated views will be stored directly within your application’s directory, giving you full control over the design and complete freedom to customize the look and feel according to your needs.
The authentication components include the following features:
To make the installation process as smooth as possible, we’ve prepared a custom Artisan command that automates the setup of all necessary components.
Simply run the following command in your terminal to get started:
php artisan zinq:install:auth
You can also customize the installation process by excluding certain components:
--no-password
flag,--no-email-verification
flag.Once the installation is complete, the next step is to configure your application’s routing to ensure the authentication system works correctly.
To set up the login and registration routes, add the following code to your routes/web.php
file:
Route::group(['middleware' => 'guest'], function () {
Route::get('/login', \App\Livewire\Auth\Login::class)
->name('login');
Route::get('/login/{email}', \App\Livewire\Auth\LoginEmail::class)
->name('login-email')
->middleware('signed:relative');
Route::get('/register', \App\Livewire\Auth\Register::class)
->name('register');
});
To set up the password reset routes, update the group with guest
middleware in your routes/web.php
file:
Route::group(['middleware' => 'guest'], function () {
// ...
Route::get('/forgot-password', \App\Livewire\Auth\ForgotPassword::class)
->name('password.request');
Route::get('/reset-password/{token}/{email}', \App\Livewire\Auth\ResetPassword::class)
->name('password.reset');
});
The email verification functionality was built using Laravel’s built-in Email Verification.
It consists of the following parts:
routes/web.php
file:Route::group(['middleware' => ['auth']], function () {
Route::get('/email/verify-notification', \App\Livewire\Auth\EmailVerificationNotice::class)
->name('verification.notice');
Route::group(['middleware' => ['verified']], function () {
// Your protected routes here...
});
});
routes/web.php
file:use Illuminate\Foundation\Auth\EmailVerificationRequest;
Route::group(['middleware' => ['auth:admin']], function () {
// ...
Route::get('/email/verify/{id}/{hash}', function (EmailVerificationRequest $request) {
$request->fulfill();
return redirect()->route('dashboard');
})
->middleware('signed')
->name('verification.verify');
// ...
//
});