jeffersongoncalves / filament-user
Filament User model, UserResource, status-aware Login page and plugin for the jeffersongoncalves starter kits.
Package info
github.com/jeffersongoncalves/filament-user
pkg:composer/jeffersongoncalves/filament-user
Requires
- php: ^8.3
- filament/filament: ^5.0
- jeffersongoncalves/filament-additional-information: ^3.0
- jeffersongoncalves/laravel-user: ^1.0
- spatie/laravel-package-tools: ^1.16
- stechstudio/filament-impersonate: ^5.4
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.21
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- pestphp/pest-plugin-livewire: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Filament User
Filament User model, UserResource, status-aware Login page and plugin used by the jeffersongoncalves starter kits. Built on laravel-user.
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-user
Usage
Model
namespace App\Models; use JeffersonGoncalves\Filament\User\Models\User as BaseUser; class User extends BaseUser { // add traits (e.g. HasTeamsFilament), relations or overrides here }
It implements FilamentUser and HasAvatar (reads the filament-edit-profile.avatar_column).
Panel access
By default a user can enter every panel except admin, and only while status = true. Filament re-checks this on every request, so deactivating a user also ends their open sessions and remember-me logins.
Tune the rules in the config file:
php artisan vendor:publish --tag="filament-user-config"
// config/filament-user.php 'panel_access' => [ 'denied_panels' => ['admin'], 'require_active_status' => true, ],
Or replace the check entirely from a service provider (e.g. AppServiceProvider::boot()):
use Filament\Panel; use JeffersonGoncalves\Filament\User\Facades\PanelAccess; PanelAccess::using(fn (User $user, Panel $panel): bool => $user->status && $panel->getId() === 'app');
Panel
use JeffersonGoncalves\Filament\User\Pages\Auth\Login; use JeffersonGoncalves\Filament\User\UserPlugin; // Panel where users sign in: only active users (status = true) can log in $panel->login(Login::class); // Panel that manages users (usually the admin panel) $panel->plugins([ UserPlugin::make() ->impersonate(guard: 'web', redirectTo: '/app'), ]);
The resource uses the model from auth.providers.users.model, so it always works with App\Models\User.
Other plugin options:
UserPlugin::make() ->withoutImpersonation() // hide the impersonate action (table, View and Edit pages) ->navigationGroup('Access'); // custom navigation group; false = no group
Translations
Labels ship in 19 locales (ar, az, de, en, es, fa, fr, hi, it, ja, nl, pl, pt, pt_BR, ru, tr, uk, uz, zh_CN) under the filament-user::resources/user.* namespace (navigation.*, fields.*, actions.*). To change them, publish and edit:
php artisan vendor:publish --tag="filament-user-translations"
Extending
Extend the resource and hand it to the plugin. The resource pages follow the plugin, so there is nothing else to copy:
use JeffersonGoncalves\Filament\User\Resources\Users\Schemas\UserForm; use JeffersonGoncalves\Filament\User\Resources\Users\UserResource; class MyUserForm extends UserForm { public static function components(): array { return [ ...parent::components(), TextInput::make('phone'), ]; } } class MyUserResource extends UserResource { public static function form(Schema $schema): Schema { return MyUserForm::configure($schema); } } UserPlugin::make()->resource(MyUserResource::class);
UserInfolist::components() and UsersTable::columns() 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.
