add cms banners

This commit is contained in:
JaguarJack
2021-05-26 20:35:19 +08:00
parent 4b30123aa4
commit af8e6c3f5d
4 changed files with 150 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace catchAdmin\cms\tables\forms;
use catchAdmin\cms\model\Category;
use catcher\library\form\Form;
class Banners extends Form
{
public function fields(): array
{
$categories = Category::field(['id', 'name', 'parent_id'])->select()->toTree();
// TODO: Implement fields() method.
return [
self::cascader('category_id', '选择分类', [])
->options($categories)
->clearable(true)
->filterable(true)
->showAllLevels(false)
->props([
'props' => [
'value' => 'id',
'label' => 'name',
'checkStrictly' => true
],
])->style(['width' => '100%'])
->required(),
self::input('title', '标题')->placeholder('请输入标题')->required(),
self::image('图片', 'banner_img'),
self::input('link_to', '外链')->appendValidate([
self::validateUrl()
])
];
}
}