快速CRUD
<?php
namespace App\Admin\Controller;
use Illuminate\Routing\Controller;
use ModStart\Admin\Concern\HasAdminQuickCRUD;
use ModStart\Admin\Layout\AdminCRUDBuilder;
class NewsController extends Controller
{
use HasAdminQuickCRUD;
protected function crud(AdminCRUDBuilder $builder)
{
$builder
->init('news')
->field(function ($builder) {
$builder->id('id','ID');
$builder->text('title', '名称');
$builder->image('cover', '封面');
$builder->textarea('summary', '摘要');
$builder->display('created_at', '创建时间');
$builder->display('updated_at', '更新时间');
})
->title('新闻管理');
}
}
字段支持
$builder->display('field','名称');
单行文本 text
多选 checkbox
$builder->checkbox('field', '名称');
$builder->tags('field', '名称');
代码 code
$builder->code('field', '名称');
树状组件 tree
$builder->tree('field', '名称');
类型 type
$builder->type('field', '类型');
密码 password
$builder->password('field', '类型');
单张图片 image
$builder->image('field', '类型');
多张图片 images
$builder->type('field', '类型');
多张图片(临时路径) imagesTemp
$builder->type('field', '类型');
链接 link
$builder->switch('field', '类型');
多行文本 textarea
$builder->textarea('field', '类型');
颜色 color
$builder->color('field', '类型');
日期 date
日期时间 datetime
$builder->datetime('field', '类型');
时间 time
$builder->time('field', '类型');
单选 radio
$builder->radio('field', '类型');
下拉 select
$builder->select('field', '类型');
富文本 richHtml
$builder->richHtml('field', '类型');
Markdown markdown
$builder->markdown('field', '类型');
键值对列表 keyValueList
$builder->keyValueList('field', '类型');
多值 values
$builder->values('field', '类型');
数字 number
$builder->number('field', '类型');
百分比 percent
$builder->percent('field', '类型');
小数 decimal
$builder->decimal('field', '类型');
货币 currency
$builder->currency('field', '类型');
ID id
$builder->id('field', '类型');
验证码 captcha
$builder->captcha('field', '类型');
临时文件 fileTemp
$builder->fileTemp('field', '类型');
文件 file
$builder->file('field', '类型');
视频 video
$builder->video('field', '类型');
音频 audio
$builder->audio('field', '类型');
中国地区 areaChina
$builder->areaChina('field', '类型');
$builder->hidden('field', '类型');
图标 icon