Behind the scenes cybercog/laravel-ban is used.
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"
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;
}
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
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'),
]);
}
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.