nurmuhammet / dynamic-fields
laravel nova 动态字段
1.1.0
2023-08-14 16:31 UTC
Requires
- php: ^7.3|^8.0
- laravel/framework: ^8.0|^9.0|^10.0
- laravel/nova: ^4.0
README
laravel nova 动态字段。可以将资源属性填充为给定名称。对于多对多关系也非常有用。支持依赖字段。
需求
php: >=8.0
laravel/nova: ^4.0
安装
使用 Composer 在 Laravel Nova 项目中安装此包
# Install nova-inputmask
composer require nurmuhammet/dynamic-fields
用法
use Nurmuhammet\DynamicFields\DynamicFields; // ... DynamicFields::make('Attributes', 'attributes') ->fields([ ['type' => 'text', 'name' => 'Brand', 'label' => 'Label', 'required' => true, 'placeholder' => 'Adidas...', 'default' => 'default value'], ['type' => 'number', 'name' => 'B'], ['type' => 'select', 'name' => 'Colour', 'label' => 'Colour of product', 'options' => [ ['label' => 'A', 'value' => 10], ['label' => 'B', 'value' => 19] ]] ]) ->fillWithArrayName('names') // if you want form name should be array, like: `names[]`
fields(array|callable $fields)
如果传递了闭包,闭包必须返回一个数组
fillWithArrayName(string $requestArrayName = '')
将所有字段名称和值填充到一个数组中
如果你觉得我的开源库很有帮助,请考虑通过购买我一杯咖啡来支持它:买我一杯咖啡。☕