承接 luttje/filament-user-attributes 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

luttje/filament-user-attributes

Composer 安装命令:

composer require luttje/filament-user-attributes

包简介

Let your users specify custom attributes for models.

README 文档

README

Filament User Attributes

Warning

This package is still in development. It is not yet ready for production use and the API may change at any time.

Tests Coverage Status Fix PHP Code Styling

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:

  1. A checkbox is added and it's order in the table and form is specified.
  2. 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

  1. 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
  2. Install the package via composer:

    composer require luttje/filament-user-attributes
  3. 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.

  4. 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.

  5. 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:

🎉 You're now ready to:
🖇 Let your users configure which attributes should be added to models
🎈 Have the custom attribute fields and columns display in a Livewire component
📎 Set and use the user attributes yourself

✏ 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
  • 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
    • PDF
    • 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 luttje/filament-user-attributes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 59
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-06