reg2005 / oc-jsonable
此小部件是“重复器”小部件的替代品,允许将数据写入jsonable字段,就像“重复器”一样,但不会提供重复字段的机会。即数组将如下所示
1.0.1
2016-07-10 12:24 UTC
Requires
- php: >=5.5.9
This package is not auto-updated.
Last update: 2024-09-14 19:09:32 UTC
README
此小部件是重复器小部件的替代品,允许将数据写入jsonable字段,就像“重复器”一样。
如何使用
0.1 在数据库中创建一个json或jsonb或text字段。
0.2 添加到模型中
public $jsonable = ['config'];
1. 只需将以下内容添加到您的插件或项目的composer.json文件中
{ "require": { "reg2005/oc-jsonable": "1.0.*" } }
2. 进入您的october项目目录,使用终端运行以下命令
composer update
3. 将以下内容添加到您的Plugin.php中
public function registerFormWidgets() { return [ 'reg2005\Widgets\Jsonable' => [ 'label' => 'jsonable', 'code' => 'jsonable' ] ]; }
将以下内容添加到您的fields.yaml中
fields: config[customization]: label: 'extra' type: jsonable form: fields: form_color: label: 'Color' oc.commentPosition: '' span: left type: colorpicker background: label: 'Background' oc.commentPosition: '' mode: image useCaption: 0 thumbOptions: mode: crop extension: jpg span: left type: fileupload time[mon]: label: Monday type: jsonable span: left form: fields: from: label: 'From' oc.commentPosition: '' span: left default: '09:00' type: datepicker format: 'H:i' mode: time to: label: 'To' oc.commentPosition: '' span: right default: '18:00' format: 'H:i' type: datepicker mode: time time[tue]: label: Tuesday type: jsonable span: left form: fields: from: label: 'From' oc.commentPosition: '' span: left default: '09:00' type: datepicker mode: time to: label: 'To' oc.commentPosition: '' span: right default: '18:00' type: datepicker mode: time