Ban Guard plugin screenshot
Dark mode ready
Multilingual support
Supports v5.x

Ban Guard

Community

Ban or suspend users from your panel, with middleware that also blocks API access and login.

Tags: Action Panel Authorization Panels
Supported versions:
5.x
Third-party plugin. This is built by the community, not the Filament team. Filament does not review, endorse, or vet the security of plugins outside the filament/ namespace. Review the source and install at your own risk. Found malware or an unresolved security issue the author won't address? Report it .
Muazzam Ali khan avatar Author: Muazzam Ali khan

Documentation

Filament Ban

Ban and suspend users from Filament v5. Add actions to your user resource; middleware blocks the panel, API, and login when an account is banned or suspended.

Users table with Ban, Suspend, and Unban actions

#Requirements

Dependency Version
PHP ^8.2
Laravel ^11 / ^12
Filament ^5.0

#Installation

composer require muazzambuilds/filament-ban

Publish the config and migration:

php artisan vendor:publish --tag=filament-ban-config
php artisan vendor:publish --tag=filament-ban-migrations
php artisan migrate

#Setup

#1. Add the trait to your user model

use MuazzamBuilds\FilamentBan\Concerns\Bannable;

class User extends Authenticatable
{
    use Bannable;
}

#2. Register the panel plugin

use MuazzamBuilds\FilamentBan\BanPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(BanPlugin::make());
}

This attaches auth middleware so banned / suspended users cannot use the panel (and are logged out).

#3. Protect API routes

Route::middleware(['auth:sanctum', 'banned'])->group(function () {
    //
});

Login is blocked automatically via Laravel’s Validated auth event — no custom login page required.

#4. Add actions to your user resource

use MuazzamBuilds\FilamentBan\Actions\BanAction;
use MuazzamBuilds\FilamentBan\Actions\SuspendAction;
use MuazzamBuilds\FilamentBan\Actions\UnbanAction;
use MuazzamBuilds\FilamentBan\Actions\UnsuspendAction;

public function getRecordActions(): array
{
    return [
        BanAction::make(),
        UnbanAction::make(),
        SuspendAction::make(),
        UnsuspendAction::make(),
    ];
}

Or on a table:

->recordActions([
    BanAction::make(),
    UnbanAction::make(),
    SuspendAction::make(),
    UnsuspendAction::make(),
])

#Behaviour

State Effect
Banned (banned_at set) Permanent block until unbanned
Suspended (suspended_until in the future) Temporary block; lifts automatically when the time passes

Blocked users:

  • Cannot log in (validation error with ban/suspend message)
  • Are rejected from Filament panels (plugin middleware)
  • Are rejected from routes using the banned middleware (API-friendly JSON 403)

#Model API

$user->ban('Spam');
$user->unban();
$user->suspend(now()->addDays(7), 'Cool down');
$user->unsuspend();

$user->isBanned();
$user->isSuspended();
$user->isAccessBlocked();

Query scopes: User::banned(), User::notBanned(), User::suspended(), User::accessBlocked().

#Config

// config/filament-ban.php
'user_model' => 'App\\Models\\User',
'logout' => true,
'api_status' => 403,
'web_redirect' => null, // route name or path; null throws AuthenticationException

#Support

If this package helps you, consider supporting development:

Buy Me A Coffee

#License

MIT

The author

Muazzam Ali khan avatar Author: Muazzam Ali khan

AI Engineer & Laravel Developer building intelligent SaaS products, AI agents, and Filament applications. I help founders ship production-ready software — from AI automation to Laravel & Filament admin panels, SaaS platforms, and AI-powered ecommerce. I publish plugins and tutorials as Muazzam Builds.

What I'm Building

  • AI Agents & business automation
  • Laravel & Filament applications
  • SaaS products and AI ecommerce

Tech Stack

Laravel • PHP • Filament • Livewire • MySQL • Python • Docker • OpenAI • Cloudflare • AWS

Connect

Plugins
4
Stars
1

From the same author