GithubHelp home page GithubHelp logo

filament-breezy's Introduction

Banner

A custom package for Filament with login flow, profile and teams support.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

Screenshots

Screenshot of Login Screenshot of Profile Screenshot of Register Screenshot of Reset Screenshot of Reset

Installation

  1. Install the package via composer:
composer require jeffgreco13/filament-breezy
  1. 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"

Usage

Email Verification

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
    ],
    ....

Extending and Overriding Components

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;
    }
...

Sanctum API Tokens

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.

Flash Notifications

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.",
]);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

filament-breezy's People

Contributors

creativeplus2 avatar felipe-balloni avatar jeffgreco13 avatar jvkassi avatar mohamedsabil83 avatar underdpt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.