luttje/filament-user-attributes
Composer 安装命令:
composer require luttje/filament-user-attributes
包简介
Let your users specify custom attributes for models.
README 文档
README
Warning
This package is still in development. It is not yet ready for production use and the API may change at any time.
Filament User Attributes
Let your users specify custom attributes for models in Filament, similar to Custom Fields in WordPress. For Laravel 11-13 and Filament 4-5.
Demonstration: showing the creation of a custom user attribute for the 'Locations' resource of this app:
demonstration.mp4
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.
🚀 Getting started
-
Make sure your project meets these requirements:
- PHP 8.2 or higher
- Livewire 3.4 or 4 or higher
- Filament 4 or 5 or higher
- A database that supports JSON columns, e.g:
- MySQL 5.7.8 or higher
- PostgreSQL 9.2 or higher
- SQLite 3.38 or higher
-
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:
- Specify which models should have custom user attributes
- Setup a model that can configure the user attributes for each user (e.g. a user or tenant model)
- Setup resources that the configuration model can configure custom attributes for
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
UserAttributeConfigResourceclass:// 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:
✏ Customizing
-
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
✨ Features
- Add custom attributes to any model
- Support for UUIDs
- Support for ULIDs
- Easily display the attributes in a Filament form
- Easily display the attributes in a Filament table
- Sensible validations for input types
- User interface for managing user attributes, including:
- Allow users to specify order of attributes
- In the form
- In the table
- Allow users to hide attributes
- In the form
- In the table
- Users can specify default values for attributes
- Users can specify if attributes are required
- Users can specify if attributes inherit their value from another attribute, even from a related model, for:
- Resources
- Livewire components (if they implement the static
::getModel()method) - Related fields that have a {relation}_id field in the form
- Related attributes that have no field in this form
- Fields nested inside layout components (Section, Tabs, Fieldset) whose children are defined via a
Closure— these cannot be resolved outside a Livewire context and will not appear in the inherit attribute dropdown
- Allow users to specify if an attribute should have a limit, wrap text or format as currency
- Allow users to specify if an attribute should be searchable and/or sortable
- Support for toggleable attribute columns in the table on a per-user basis
- Allow users to specify order of attributes
- Support for Tabs and Sections in the form
- Wizard command to help you setup your project code
Supported Input types:
- Text
- Textarea
- Number
- Integer
- Decimal
- Specific range
- Specific decimal places
- Select
- Specific options
- From an existing model property
- Radio
- Specific options
- From an existing model property
- Tags
- With suggestions
- Date
- Date
- Time
- Date and time
- Checkbox
- With default
- Toggle
- With default
- File
- Image
- Other
- Preview
- Color
❤ Contributing
Please see CONTRIBUTING for details on how to contribute to this project. You'll also find instructions on how to run the tests.
luttje/filament-user-attributes 适用场景与选型建议
luttje/filament-user-attributes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 59 次下载、GitHub Stars 达 9, 最近一次更新时间为 2023 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「luttje」 「filament-user-attributes」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 luttje/filament-user-attributes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 luttje/filament-user-attributes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 luttje/filament-user-attributes 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Use comments in markdown to automatically compile tested examples into your README
Laravel Dusk helpers for working with Livewire
Alfabank REST API integration
Let your users configure an ID style and then use that ID style in your application.
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
统计信息
- 总下载量: 59
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-06


