deldius / filament-user-field
Utility fields for User: Entry, Input, Column
Fund package maintenance!
Deldius
Requires
- php: ^8.1
- filament/filament: ^4.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^8
- orchestra/testbench: ^10.0
- pestphp/pest: ^3
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
This package is auto-updated.
Last update: 2025-07-28 10:38:15 UTC
README
This is a plugin for Filament v4
Screenshots
Installation
You can install the package via composer:
composer require deldius/filament-user-field
You can publish the config file with:
php artisan vendor:publish --tag="filament-user-field-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-user-field-views"
This is the contents of the published config file:
return [ 'user_model' => [ 'class' => \App\Models\User::class, // Default user model 'fields' => [ 'id' => 'id', // Default user model ID field 'avatar_url' => 'avatar_url', // Default user model avatar field 'heading' => 'name', // Default user model name field 'description' => 'email', // Default user model email field ], ], 'active_state' => [ 'show' => false, // Show active state by default 'field' => 'is_active', // Default field for active state ], ];
Usage
UserColumn (for Filament Tables)
Display user information in a Filament table column:
use Deldius\UserField\UserColumn; use Filament\Support\Enums\Size; UserColumn::make('user_id') ->showActiveState() // Show active/inactive indicator ->size(Size::Small) // Set avatar size ->label('User') // Column label
Add UserColumn
to your Filament table columns:
public static function configure(Table $table): Table { return [ UserColumn::make('user_id'), // ...other columns ]; }
All available options:
use Deldius\UserField\UserColumn; use Filament\Support\Enums\Size; UserColumn::make('user_id') ->showActiveState(true) // Show active/inactive indicator ->isActiveState(fn($user) => $user->is_active) // Custom active state logic ->showAvatar(true) // Show avatar ->avatarUrl(fn($user) => $user->avatar_url) // Custom avatar URL ->size(Size::Small) // Set avatar size ->heading(fn($user) => $user->name) // Custom heading ->description(fn($user) => $user->email) // Custom description ->emptyState(view('empty')) // Custom empty state view ->emptyStateHeading('No user') // Custom empty state heading ->emptyStateDescription('No user found') // Custom empty state description ->label('User') // Column label
Add UserColumn
to your Filament table columns:
public static function configure(Table $table): Table { return [ UserColumn::make('user_id'), // ...other columns ]; }
UserEntry (for Filament Infolists)
Display user information in a Filament infolist entry:
use Deldius\UserField\UserEntry; use Filament\Support\Enums\Size; UserEntry::make('user_id') ->showActiveState() // Show active/inactive indicator ->size(Size::Small) // Set avatar size ->label('User') // Entry label
Add UserEntry
to your Filament infolist schema:
public static function configure(Schema $schema): Schema { return [ UserEntry::make('user_id'), // ...other items ]; }
Display user information in a Filament infolist entry. All available options:
use Deldius\UserField\UserEntry; use Filament\Support\Enums\Size; UserEntry::make('user_id') ->showActiveState(true) // Show active/inactive indicator ->isActiveState(fn($user) => $user->is_active) // Custom active state logic ->showAvatar(true) // Show avatar ->avatarUrl(fn($user) => $user->avatar_url) // Custom avatar URL ->size(Size::Small) // Set avatar size ->heading(fn($user) => $user->name) // Custom heading ->description(fn($user) => $user->email) // Custom description ->emptyState(view('empty')) // Custom empty state view ->emptyStateHeading('No user') // Custom empty state heading ->emptyStateDescription('No user found') // Custom empty state description ->label('User') // Entry label
Add UserEntry
to your Filament infolist schema:
public static function configure(Schema $schema): Schema { return [ UserEntry::make('user_id'), // ...other items ]; }
UserSelect (for Filament Form)
Planned feature: UserSelect support for Filament Form is in development and will be added in a future release.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.