arbory/nova-grouped-boolean-field-group
Composer 安装命令:
composer require arbory/nova-grouped-boolean-field-group
包简介
A Laravel Nova field.
README 文档
README
Field which extends default Laravel Nova BooleanGroup field to be able to pass grouped collections.
To resolve and hydrate the field values, custom callbacks can be passed either to field constructor as arguments
or via fillUsing() and resolveUsing() field callbacks.
For field values, either pass a grouped collection or a custom callback to options() field callback.
Installation
composer require arbory/nova-grouped-boolean-field-group
Basic Usage:
Field instantiation with all arguments passed via constructor:
GroupedBooleanGroup::make( __('nova-permission-tool::roles.permissions'), 'permissions', 'name', function ($value, $model) { return $model->resolveNovaPermissions(); }, function ($request, $model, string $attribute, string $requestAttribute) { return $model->saveNovaPermissions(json_decode($request[$requestAttribute], true)); } )->options(Permission::getPermissionsGroups())
or via field callbacks:
GroupedBooleanGroup::make( __('nova-permission-tool::roles.permissions'), 'permissions', 'name' ) ->fillUsing(function ($request, $model, string $attribute, string $requestAttribute) { return $model->saveNovaPermissions(json_decode($request[$requestAttribute], true)); }) ->resolveUsing(function ($value, $model) { return $model->resolveNovaPermissions(); }) ->options(Permission::getPermissionsGroups())
Mapping field options
By default, field option key and value pairs will contain value of specified optionNameAttribute.
For custom option labels, use setOptionLabelAttribute() field method.
Customising field layout
The field has 3 custom layouts available - row layout, full width column layout and full width layout.
Row layout can be enabled via setRowLayout() method.
Full width column layout can be enabled via setFullWidthColumnLayout() method.
Full width layout can be enabled via setFullWidth() method.
Field group and global toggles
Field groups and entire field content can be made collapsible.
Field group toggles can be enabled via withGroupToggling() method. Global field toggle can be enabled via withGlobalToggle() method.
When using toggles, it is also possible to specify toggle state, whether the field or groups should be open on page load.
To keep groups open in form view, use openGroupsInForm() method.
To keep groups open in details view, use openGroupsInDetail() method.
To keep groups open in both views, use openGroups() method.
To keep field open in form view, use openFieldInForm() method.
To keep field open in details view, use openFieldInDetails() method.
To keep field open in both views, use openField() method.
Group and global select all
This feature enables a checkbox, which will make it possible to toggle an entire group or all checkboxes within this field.
To enable group select all checkbox, use withGroupSelectAll().
To enable global select all checkbox, use withGlobalSelectAll().
Filters
It is also possible to add filters via withFilters() method.
The method accepts a single parameter with filter options of type array.
This filter toggles field groups by group names that come from field field options collection.
Filter options should be keyed as ['label' => $label, 'value' => $value].
A brief example of preparing a filter options collection:
return Permission::query() ->pluck('owner_type') ->unique() ->map(function ($permissionOwner) { $filterOption = self::formatPermissionGroupKey($permissionOwner); return ['label' => $filterOption, 'value' => $filterOption]; }) ->values() ->toArray();
Custom translations for global toggle and filter field
It is possible to set custom field labels for global toggle and filter field.
To do so, use setGlobalSelectAllLabel() or setFilterLabel() method and pass a string of your choice.
arbory/nova-grouped-boolean-field-group 适用场景与选型建议
arbory/nova-grouped-boolean-field-group 是一款 基于 Vue 开发的 Composer 扩展包,目前已累计 317 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arbory/nova-grouped-boolean-field-group 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arbory/nova-grouped-boolean-field-group 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arbory/nova-grouped-boolean-field-group 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
A Laravel Nova Image field. you can paste or drag or chose an image
A Laravel Nova Mail testing tool.
统计信息
- 总下载量: 317
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-07