快速CRUD

    1. <?php
    2. namespace App\Admin\Controller;
    3. use Illuminate\Routing\Controller;
    4. use ModStart\Admin\Concern\HasAdminQuickCRUD;
    5. use ModStart\Admin\Layout\AdminCRUDBuilder;
    6. class NewsController extends Controller
    7. {
    8. use HasAdminQuickCRUD;
    9. protected function crud(AdminCRUDBuilder $builder)
    10. {
    11. $builder
    12. ->init('news')
    13. ->field(function ($builder) {
    14. $builder->id('id','ID');
    15. $builder->text('title', '名称');
    16. $builder->image('cover', '封面');
    17. $builder->textarea('summary', '摘要');
    18. $builder->display('created_at', '创建时间');
    19. $builder->display('updated_at', '更新时间');
    20. })
    21. ->title('新闻管理');
    22. }
    23. }

    字段支持

    1. $builder->display('field','名称');

    单行文本 text

      多选 checkbox

      1. $builder->checkbox('field', '名称');

      标签 tags

      1. $builder->tags('field', '名称');

      代码 code

      1. $builder->code('field', '名称');

      树状组件 tree

      1. $builder->tree('field', '名称');

      类型 type

      1. $builder->type('field', '类型');

      密码 password

      1. $builder->password('field', '类型');

      单张图片 image

      1. $builder->image('field', '类型');

      多张图片 images

      1. $builder->type('field', '类型');

      多张图片(临时路径) imagesTemp

      1. $builder->type('field', '类型');
      1. $builder->switch('field', '类型');

      多行文本 textarea

      1. $builder->textarea('field', '类型');

      颜色 color

      1. $builder->color('field', '类型');

      日期 date

      日期时间 datetime

      1. $builder->datetime('field', '类型');

      时间 time

      1. $builder->time('field', '类型');

      单选 radio

      1. $builder->radio('field', '类型');

      下拉 select

      1. $builder->select('field', '类型');

      富文本 richHtml

      1. $builder->richHtml('field', '类型');

      Markdown markdown

      1. $builder->markdown('field', '类型');

      键值对列表 keyValueList

      1. $builder->keyValueList('field', '类型');

      多值 values

      1. $builder->values('field', '类型');

      数字 number

      1. $builder->number('field', '类型');

      百分比 percent

      1. $builder->percent('field', '类型');

      小数 decimal

      1. $builder->decimal('field', '类型');

      货币 currency

      1. $builder->currency('field', '类型');

      ID id

      1. $builder->id('field', '类型');

      验证码 captcha

      1. $builder->captcha('field', '类型');

      临时文件 fileTemp

      1. $builder->fileTemp('field', '类型');

      文件 file

      1. $builder->file('field', '类型');

      视频 video

      1. $builder->video('field', '类型');

      音频 audio

      1. $builder->audio('field', '类型');

      中国地区 areaChina

      1. $builder->areaChina('field', '类型');
      1. $builder->hidden('field', '类型');

      图标 icon