Ban Guard by Muazzam Ali khan
CommunityBan or suspend users from your panel, with middleware that also blocks API access and login.
Author:
Muazzam Ali khan
Package health
Automated checks of this plugin's Composer package
15 checks
- Skipped: GitHub Actions pinned to SHA
- Skipped: GitLab CI includes pinned to SHA
- Skipped: Open security advisories
- Passed: Dependabot PR responsiveness — No open Dependabot PRs.
- Skipped: Renovate MR responsiveness
- Skipped: Dependabot or Renovate configured
- Skipped: Dependency update cooldown configured
- Failed: Provides a security policy — View details on Plumb
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Warning: Commit and release recency — Low activity: last commit 91 days ago; no release date available.
- Skipped: composer.lock not committed by library
- Skipped: Dist archive is lean
- Skipped: Current Laravel version supported
- Skipped: Current PHP version supported
- Skipped: Current Symfony version supported
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
.
Documentation
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.
#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
bannedmiddleware (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:
#License
MIT
The author
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
From the same author
Turnstile
Cloudflare Turnstile panel plugin — register once to auto-protect login, registration, and password reset.
Author:
Muazzam Ali khan
AI Actions
OpenAI-powered actions for Filament v5. Drop complete Summarize, Rewrite, and Classify actions onto tables and forms — no DIY prompt wiring. Install via Composer, set OPENAI_API_KEY, then attach actions to table record actions or page header actions. Optionally write results back to a model attribute with applyTo().
Author:
Muazzam Ali khan
Recycle Bin
Central soft-deletes recycle bin for Filament v5. Register once, then restore or permanently delete trashed records from every SoftDeletes model in one place.
Author:
Muazzam Ali khan
Panel Branding
Rebrand your Filament panel from a settings page — logos, colors, fonts, layout, footer, and custom CSS, with per-panel and optional per-tenant support.
Author:
Muazzam Ali khan
Featured Plugins
A selection of plugins curated by the Filament team
Soft Theme
A theme that gives panels a warm, approachable look with rounded shapes, gentle colors, and serif headings.
Filament
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight like Command Palette to your Filament Panel.
Dennis Koch
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese