1. Go to this page and download the library: Download gerenuk/filament-banhammer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gerenuk / filament-banhammer example snippets
namespace App\Providers\Filament;
use Filament\Panel;
use Filament\PanelProvider;
use Gerenuk\FilamentBanhammer\FilamentBanhammerPlugin;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(FilamentBanhammerPlugin::make());
}
}
public function getFilamentBanhammerTitleAttribute()
{
return $this->name;
}
use Filament\Tables\Table;
use Gerenuk\FilamentBanhammer\Resources\Actions\BanAction;
public static function table(Table $table): Table
{
return $table
->columns([
// ...
])
->actions([
BanAction::make(),
]);
}
use Filament\Tables\Table;
use Gerenuk\FilamentBanhammer\Resources\Actions\UnbanAction;
public static function table(Table $table): Table
{
return $table
->columns([
// ...
])
->actions([
UnbanAction::make(),
]);
}
use Filament\Tables\Table;
use Gerenuk\FilamentBanhammer\Resources\Actions\BanBulkAction;
public static function table(Table $table): Table
{
return $table
->columns([
// ...
])
->bulkActions([
BanBulkAction::make(),
]);
}
use Filament\Tables\Table;
use Gerenuk\FilamentBanhammer\Resources\Actions\UnbanBulkAction;
public static function table(Table $table): Table
{
return $table
->columns([
// ...
])
->bulkActions([
UnbanBulkAction::make(),
]);
}