thiktak/filament-sql-nested-builder-form
Composer 安装命令:
composer require thiktak/filament-sql-nested-builder-form
包简介
Plugin for FilamentPHP - SQL Nested Builder Form Component
关键字:
README 文档
README
An application of thiktak/filament-nested-builder-form for SQL with (not) AND/OR and sub-groups.
Warning
Be careful, this package is not yet recommended for production. Help us with testing and feedback :)
Installation
You can install the package via composer:
composer require thiktak/filament-sql-nested-builder-form
This package is based on thiktak/filament-nested-builder-form.
Usage
// use App\Models\User; use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedBuilder; use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedSubBuilder; use Thiktak\FilamentSQLNestedBuilderForm\Forms\Components\SQLNestedBuilder; public static function form(Form $form): Form { return $form ->schema([ Section::make('Nested Builder Form') ->description('Example of the SQL Nested Builder Form (SQL Query)') ->schema([ // configuration is an Array SQLNestedBuilder::make('configuration') // nestedConfiguration apply this set up to all children ->nestedConfiguration(function (NestedSubBuilder $builder, NestedBuilder $parent) { // import default configuration of this package $parent->defaultNestedConfiguration($builder); }) // Display the first Hint as a Raw SQL query of User Model ->hint(function (?array $state) { return SQLNestedBuilder::getFullyLinearizedArrayToEloquent($state, User::query()) ->getQuery() ->toRawSql() ; }) ]), ]); }
Configuration
Change the field Input (name of the field)
Use the nestedConfiguration and set up fieldComponent
SQLNestedBuilder::make('configuration') ->nestedConfiguration(function (NestedSubBuilder $builder, NestedBuilder $parent) { // import default configuration of this package $parent->defaultNestedConfiguration($builder); // Change the TextInput -> Select $parent->fieldComponent( fn () => Select::make('field') ->options([ 'id' => 'User Id', 'email' => 'User email', ]) ->searchable() ); })
Export to SQL (string)
This method will return the Raw SQL of a User model query. $state is the data array.
SQLNestedBuilder::getFullyLinearizedArrayToEloquent($state, User::query()) ->getQuery() ->toRawSql()
Output (example):
select * from `users` where ( ( not ( (`a` = '1') and (`b` in ('2', '3')) and (`a` between '1' and '99') ) or (`email` LIKE '%admin.com%') or (`email` LIKE 'a%') or (`email` LIKE '%com') ) and (`tenant_id` = '1') )
Export to Eloquent
SQLNestedBuilder::getFullyLinearizedArrayToSQL(?array $state); // If consume the whole array SQLNestedBuilder::getFullyLinearizedArrayToSQL(?array $state, 'group'); // if level of group SQLNestedBuilder::getFullyLinearizedArrayToSQL(?array $state, 'rule'); // if level of rule
Output (example):
(`a` = '1' AND `b` IN ('2', '3') AND `a` BETWEEN '1' AND '99') AND `email` LIKE '%admin.com%' AND `email` LIKE 'a%' AND `email` LIKE '%com'
Add custom operators
(current solution) Extend the SQLNesterBuilder, and redefine the method loadDefinition() with a call to $this->registerOperator(MyOperator::class)
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.
thiktak/filament-sql-nested-builder-form 适用场景与选型建议
thiktak/filament-sql-nested-builder-form 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 09 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「filament-plugin」 「Thiktak」 「filament-nested-builder-form」 「filament-sql-nested-builder-form」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thiktak/filament-sql-nested-builder-form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thiktak/filament-sql-nested-builder-form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thiktak/filament-sql-nested-builder-form 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Plugin for FilamentPHP - Nested Builder Form Component
jitone-ai is a powerful FilamentPHP plugin that integrates AI-powered features directly into your Filament forms.
Send Notification to discord channel Webhook using native FilamentPHP Notification Facade class
Alfabank REST API integration
Database-driven onboarding for Filament: progress checklists and guided spotlight tours, translatable to any locale.
Filament plugins
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-14