### Install filament-ban via Composer Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Install the package via Composer. ```bash composer require jeffersongoncalves/filament-ban ``` -------------------------------- ### Run development commands Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Development commands for static analysis, tests, and code formatting. ```bash # Run static analysis composer analyse # Run tests composer test # Format code composer format ``` -------------------------------- ### Publish and run cybercog/laravel-ban migration Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Publish and run the cybercog/laravel-ban migration to create the bans table. ```bash php artisan vendor:publish --provider="Cog\Laravel\Ban\Providers\BanServiceProvider" --tag="migrations" php artisan migrate ``` -------------------------------- ### Add bulk ban/unban actions Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Add bulk ban/unban actions to the table toolbar. ```php use JeffersonGoncalves\Filament\Ban\Actions\BanBulkAction; use JeffersonGoncalves\Filament\Ban\Actions\UnbanBulkAction; $table->toolbarActions([ BanBulkAction::make(), UnbanBulkAction::make(), ]); ``` -------------------------------- ### Add BanColumn to table Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Display the current ban status as a boolean icon in the table. ```php use JeffersonGoncalves\Filament\Ban\Tables\Columns\BanColumn; $table->columns([ BanColumn::make(), ]); ``` -------------------------------- ### Add BanAction and UnbanAction to table Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Add ban/unban buttons to a resource table row. Each action shows only when relevant (Ban when not banned, Unban when banned). BanAction opens a modal for optional comment and expiration date. ```php use JeffersonGoncalves\Filament\Ban\Actions\BanAction; use JeffersonGoncalves\Filament\Ban\Actions\UnbanAction; public function table(Table $table): Table { return $table ->recordActions([ BanAction::make(), UnbanAction::make(), ]); } ``` -------------------------------- ### Make User model bannable Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Make an Eloquent model bannable by implementing the contract and using the trait. ```php 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; } ``` -------------------------------- ### Add banned_at column to users table Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Add a nullable banned_at timestamp column to each bannable model's table. ```php Schema::table('users', function (Blueprint $table) { $table->timestamp('banned_at')->nullable(); }); ``` -------------------------------- ### Add BanFilter to table Source: https://github.com/jeffersongoncalves/filament-ban/blob/3.x/README.md Filter records by ban status using the onlyBanned / withoutBanned scopes. ```php use JeffersonGoncalves\Filament\Ban\Tables\Filters\BanFilter; $table->filters([ BanFilter::make(), ]); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.