Filament Admin
Filament Admin model, AdminResource, status-aware Login page and plugin for a separate admin guard.
#Filament Admin
Filament Admin model, AdminResource, status-aware Login page and plugin for a separate admin guard. Built on laravel-admin.
#Compatibility
| Branch | Filament | Package version |
|---|---|---|
| 1.x | 3.x | ^1.0 |
| 2.x | 4.x | ^2.0 |
| 3.x | 5.x | ^3.0 |
#Installation
composer require jeffersongoncalves/filament-admin
#Usage
#Model
namespace App\Models; use JeffersonGoncalves\Filament\Admin\Models\Admin as BaseAdmin; class Admin extends BaseAdmin { // add traits, relations or overrides here }
Point auth.providers.admins.model to App\Models\Admin::class in config/auth.php. The model implements FilamentUser (any panel), HasAvatar, and canImpersonate() returns true.
#Panel
use JeffersonGoncalves\Filament\Admin\AdminPlugin; use JeffersonGoncalves\Filament\Admin\Pages\Auth\Login; $panel ->id('admin') ->authGuard('admin') ->login(Login::class) // only active admins (status = true) can log in ->plugins([ AdminPlugin::make(), ]);
Pair it with filament-user's UserPlugin::make() on the same panel to manage users too.
#Extending
use JeffersonGoncalves\Filament\Admin\Resources\Admins\AdminResource; use JeffersonGoncalves\Filament\Admin\Resources\Admins\Tables\AdminsTable; class MyAdminsTable extends AdminsTable { public static function columns(): array { return [ ...parent::columns(), TextColumn::make('locale'), ]; } } class MyAdminResource extends AdminResource { public static function table(Table $table): Table { return MyAdminsTable::configure($table); } } AdminPlugin::make()->resource(MyAdminResource::class);
The resource pages follow the plugin, so there is nothing else to copy. AdminForm::components() and AdminInfolist::components() can be extended the same way.
#Testing
composer test
#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Credits
#License
The MIT License (MIT). Please see License File for more information.