The missing toolkit from Filament Admin with Breeze-like functionality. Includes login, registration, password reset, password confirmation, email verification, and a my profile page. All using the TALL-stack, all very Filament-y.
- Install the package via composer:
composer require jeffgreco13/filament-breezy
- Update the
config/filament.php
to point to the Breezy Login::class.
"auth" => [
"guard" => env("FILAMENT_AUTH_GUARD", "web"),
"pages" => [
"login" =>
\JeffGreco13\FilamentBreezy\Http\Livewire\Auth\Login::class,
],
],
Optionally, you can publish the Breezy config file for further customizations, such as Password rules, redirect after registration, and enable/disable the profile page.
php artisan vendor:publish --tag="filament-breezy-config"
Optionally, you can publish the views using:
php artisan vendor:publish --tag="filament-breezy-views"
Uses the Laravel Email Verification service.
Implement MustVerifyEmail
on your User model:
use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements MustVerifyEmail
Then you can add the verified
middleware to any of your routes:
Route::get("/profile", function () {
// Only verified users may access this route...
})->middleware("verified");
Or, force verified emails on your entire Filament Admin by adding the EnsureEmailIsVerified
class to the auth middleware in config/filament.php
:
"middleware" => [
"auth" => [
Authenticate::class,
Illuminate\Auth\Middleware\EnsureEmailIsVerified::class
],
....
All pages within the auth flow are full-page Livewire components made to work with Filament Forms. So you can easily extend any component to add your own fields and actions:
use JeffGreco13\FilamentBreezy\Http\Livewire\Auth\Register as FilamentBreezyRegister;
class Register extends FilamentBreezyRegister
{
protected function getFormSchema(): array
{
return array_merge(parent::getFormSchema(),[
Forms\Components\Checkbox::make('consent_to_terms')->label('I consent to the terms of service and privacy policy.')->required()
]);
}
protected function getPreparedData($data): array
{
$preparedData = parent::getPreparedData($data);
$preparedData['consent_to_terms'] = $data['consent_to_terms'];
return $preparedData;
}
...
The most recent version of Laravel include Sanctum, but if you don't already have the package follow the installation instructions here.
As soon as Sanctum is installed, you are ready to allow users to create new API tokens from the Profile page. Enable this option in the config:
enable_sanctum => true
You can then control the available permissions abilities from the config, which will add each ability as a checkbox:
"sanctum_permissions" => ["create", "read", "update", "delete"]
Follow the Sanctum instructions for authenticating requests as usual.
The Breezy auth layouts use the <x-filament::notification>
component to flash messages to the page. Flash messages in the same way as you would with $this->notify()
but instead flash to the session:
session()->flash("notify", [
"status" => "success",
"message" => "Check your inbox for instructions.",
]);
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.