widiu7omo / filament-ban

Laravel Filament Ban simplify blocking and banning Eloquent models.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Filament Ban

Introduction

Behind the scenes cybercog/laravel-ban is used.

ban_user

Installation

You can install the package via composer:

composer require ttungbmt/filament-ban

You can publish and run the migrations with:

php artisan vendor:publish --tag="filament-ban-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="filament-ban-config"

Prepare bannable model

use Cog\Contracts\Ban\Bannable as BannableContract;
use Cog\Laravel\Ban\Traits\Bannable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements BannableContract
{
    use Bannable;
}

Prepare bannable model database table

Bannable model must have nullable timestamp column named banned_at. This value used as flag and simplify checks if user was banned. If you are trying to make default Laravel User model to be bannable you can use example below.

Register Ban Actions in Nova Resource

Register Ban and Unban actions inside your Model's Resource.

    public static function table(Table $table): Table
    {
        return $table
            ->prependBulkActions([
                \FilamentPro\FilamentBan\Actions\Ban::make('ban'),
                \FilamentPro\FilamentBan\Actions\Unban::make('unban'),
            ]);
    }

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.

About

Laravel Filament Ban simplify blocking and banning Eloquent models.

License:MIT License


Languages

Language:PHP 100.0%