| Install | |
|---|---|
composer require luttje/filament-user-attributes |
|
| Latest Version: | 4.0.0 |
| PHP: | ^8.2 |

[!Warning] This package is still in development. It is not yet ready for production use and the API may change at any time.
Let your users specify custom attributes for models in Filament, similar to Custom Fields in WordPress. For Laravel 11 and 12 and Filament 4.
Demonstration: showing the creation of a custom user attribute for the 'Locations' resource of this app:
In this demonstration:
- A checkbox is added and it's order in the table and form is specified.
- The checkbox is displayed in the table and form. Users can now toggle the checkbox and view the value in the table.
[!Note] This is a third-party package not affiliated with Filament or Laravel.
Make sure your project meets these requirements:
Install the package via composer:
composer require luttje/filament-user-attributes
Run the following command to fully install the package:
php artisan filament-user-attributes:install
This publishes the migrations to create the two required tables and runs them.
Run the wizard command to help you setup your project code:
php artisan filament-user-attributes:wizard
The wizard will help you:
Finally you need to show the user attributes configuration form somewhere. That way users can actually configure their custom attributes for the resource.
Create a resource and inherit from the UserAttributeConfigResource class:
// app/Filament/Resources/UserAttributeConfigResource.php
namespace App\Filament\Resources;
use Luttje\FilamentUserAttributes\Filament\Resources\UserAttributeConfigResource as BaseUserAttributeConfigResource;
class UserAttributeConfigResource extends BaseUserAttributeConfigResource
{
protected static string | BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
}
Or you can create your own resource from scratch. See the source code for inspiration.
🎉 That was all, you and your users can now configure custom attributes!
Your users (or tenants) can now configure custom attribute fields:
The configured custom attributes are (optionally) added to the resource form and table:
To modify translations, publish the translations file:
php artisan vendor:publish --tag=filament-user-attributes-translations
To modify the configuration, publish the configuration file:
php artisan vendor:publish --tag=filament-user-attributes-config
::getModel() method)Closure — these cannot be resolved outside a Livewire context and will not appear in the inherit attribute dropdownSupported Input types:
Please see CONTRIBUTING for details on how to contribute to this project. You'll also find instructions on how to run the tests.