This code forked from - Truong Thanh Tung Filament Ban
We are using laravel-ban by cybercog on the background.
- Laravel 10
- FilamentPHP
You can install the package via composer:
composer require widiu7omo/filament-bandel
You can publish and run the migrations with:
php artisan vendor:publish --tag="filament-bandel-migrations"
php artisan migrate
ou can publish and run the translations with:
php artisan vendor:publish --tag="filament-bandel-translations"
You can publish the config file from cybercog/laravel-ban with:
php artisan vendor:publish --tag="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 BanAction
and UnbanAction
actions inside your Model's Resource.
public static function table(Table $table): Table
{
return $table
->actions([
// ...rest,
\Widiu7omo\FilamentBandel\Actions\BanAction::make(),
\Widiu7omo\FilamentBandel\Actions\UnbanAction::make()
]);
}
Register BanBulkAction
and UnbanBulkAction
actions inside your Model's Resource.
public static function table(Table $table): Table
{
return $table
->prependBulkActions([
// ...rest
\Widiu7omo\FilamentBandel\Actions\BanBulkAction::make('banned_model'),
\Widiu7omo\FilamentBandel\Actions\UnbanBulkAction::make('unbanned_model'),
]);
}
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.