ttungbmt/filament-ban

This is my package filament-ban

v1.0.0 2022-04-12 02:17 UTC

This package is auto-updated.

Last update: 2024-11-11 10:15:32 UTC


README

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.