lupennat/items
最新稳定版本:v1.1.1
Composer 安装命令:
composer require lupennat/items
包简介
Laravel Nova - Items Field
README 文档
README
Requirements
php: ^7.4 | ^8laravel/nova: ^4
Installation
composer require lupennat/items
Usage
Laravel Nova array items field with sorting, validation & many display options
use Lupennat\Items\Items;
function fields() { return [ Items::make('Emails'), ] }
and be sure to cast the property as an array on your eloquent model
public $casts = [ 'emails' => 'array' ];
Validation
Use Laravel's built in array validation
Items::make('Emails')->rules([ 'emails.*' => 'email|min:10', ]),
Manually setting the attribute may be needed in some cases.
Items::make('Long Text', 'attribute')->rules([ 'attribute.*' => 'email|min:10', ]),
Additional options
| function | description | default |
|---|---|---|
->max(number) |
limit number of items allowed | false |
->draggable() |
turn on drag/drop sorting | false |
->onlyDraggable() |
turn on drag/drop sorting and off add,delete,editing | false |
->inputType(text) |
text, date, etc (support "select") | "text" |
->placeholder($value) |
the new item input text | "Add a new item" |
->actionText($value) |
value for create button | "Add" |
->disableAddingRows() |
hide the "add" button | false |
->disableDeletingRows() |
hide the "delete" button | false |
->disableEditingRows() |
input on readonly mode | false |
->displayAsList() |
display list on index as list instead of comma separated values | "group" |
Credits
Items field is based on Nova Items Field.
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-22