LaravelStisla is an authentication starter,powered by Laravel Fortify.This packages can be used to start your project shorter,it include all feature that laravel recommended implementing yourself.
To get started, you will need to install LaravelStisla using composer.This will install Laravel Fortify as well so.
composer require ibobdb/laravel-stisla
Next,run the install command:
php artisan LaravelStisla:install
This command will publish LaravelStisla providers,views and assets directory.
Install Stisla depencies. Go to stisla directory Public/stisla
.
yarn install
It will install all assets depedencies
Add this to your FortifyServiceProvider.php
in the boot()
method.
Fortify::loginView(function () {
return view('auth.login');
});
Fortify::registerView(function () {
return view('auth.register');
});
Fortify::requestPasswordResetLinkView(function () {
return view('auth.forgot-password');
});
Fortify::resetPasswordView(function ($request) {
return view('auth.reset-password', ['request' => $request]);
});
// Fortify::verifyEmailView(function () {
// return view('auth.verify-email');
// });
// Fortify::confirmPasswordView(function () {
// return view('auth.confirm-password');
// });
// Fortify::twoFactorChallengeView(function () {
// return view('auth.two-factor-challenge');
// });
In the file RouteServiceProvider.php
public const HOME = '/home' //change to
public const HOME = '/dashboard'
Add Routes routes/web.php
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
Route::get('/dashboard', function () {
return view('pages.dashboard');
});
});
This allows you to attach the verified middleware to any of your routes
By default, LaravelStisla is setup to handle the basic authentication functions (Login, Register, Password Reset) provided by Laravel Fortify.
To get started, ensure the emailVerification feature is enabled in your fortify configuration file's features array. Next, you should ensure that your App\Models\User
class implements the Illuminate\Contracts\Auth\MustVerifyEmail
interface.
use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements MustVerifyEmail
{
...
Check full documentation stisla
This allows you to attach the verified middleware to any of your routes