定制 hosnyben/nova-nested-inputs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

hosnyben/nova-nested-inputs

最新稳定版本:1.0.0

Composer 安装命令:

composer require hosnyben/nova-nested-inputs

包简介

Nova Nested Fields is a Laravel Nova field package that allows users to present their checkboxes or radio buttons in a nested, hierarchical structure. This package supports infinite nesting levels, providing a flexible solution for complex form requirements.

README 文档

README

Nova Nested Fields is a Laravel Nova field package that allows users to present their checkboxes or radio buttons in a nested, hierarchical structure. This package supports infinite nesting levels, providing a flexible solution for complex form requirements.

Requirements

  • php: >=7.3
  • laravel/nova: ^4.26

Demo

Nested radios input

Nested radio input

Nested checkbox input

Nested checkbox input

Features

  • Infinite nesting of checkbox/radio fields.
  • Easy integration with existing Laravel Nova projects.
  • Customizable display and styling options.
  • Supports dynamic addition and removal of nested items.
  • Intuitive user interface for managing nested selections.

Installation

To install the Nova Nested Fields package, use Composer:

# Install Nova Nested Inputs
composer require hosnyben/nova-nested-inputs

Usage

Now you can use the NovaNestedInputs Field with Nova. Make the NovaNestedInputs in the fields method like any other field in a Resource.

Example
// in a Nova Resource

use HosnyBEN\NovaNestedInputs\NovaNestedInputs;

public function fields(Request $request)
{
    return [
            NovaNestedInputs::make('Category', 'category_id')
                ->options(function() {
                    return [
                        ['id' => 1, 'label' => 'Parent 1'],
                        ['id' => 2, 'label' => 'Parent 2'],
                        ['id' => 3, 'label' => 'Parent 3'],
                        [
                            'id' => 4,
                            'label' => 'Parent 4',
                            'children' => [
                                ['id' => 5, 'label' => 'Child 4.1'],
                                [
                                    'id' => 6, 
                                    'label' => 'Child 4.2',
                                    'children' => [
                                        ['id' => 8, 'label' => 'Child 4.2.1'],
                                        ['id' => 9, 'label' => 'Child 4.2.2'],
                                    ],
                                ],
                                ['id' => 7, 'label' => 'Child 4.3'],
                            ],
                        ],
                    ];
                })
                ->type('radio')
                ->color('#be860f')
                ->rules('required'),
    ]
}

Settings

Option Type Description Default
type String You define either a checkbox or radio radio
color String You define the CSS supported color. It may be a hex color or rgb() or rgba() #be860f
options function() or multi-dimensional Array[]. It must respect the payload. You can define infinte loop of nested items. You may use a function if you're looking to load dynamic values of load your Eloquent model into. array()
"options" field structure
[
	[
		'id' => 1, // ID of the record
		'label' => 'My item', // String : Title of the item
		'disabled' => false, // Boolean
		'children' => [ // Array of nested item with the exact structure
			...
		]
    	],
    	...
]

License

Nova Nested Inputs is open-sourced software licensed under the MIT license.

Author

Hosny BEN

Made with ❤️ by Hosny BEN

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固