<?php
 namespace Module\Document\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Form\Form; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use Module\Document\Util\DocumentUtil; class DocumentController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $builder) { $builder ->init('document') ->field(function ($builder) { $builder->id('id', 'ID'); $builder->text('title', '名称'); $builder->richHtml('content', '内容')->listable(false); $builder->display('created_at', L('Created At'))->listable(false); $builder->display('updated_at', L('Updated At'))->listable(false); }) ->gridFilder(function (GridFilter $filter) { $filter->like('title', L('Title')); }) ->title('文档管理') ->enablePagination(false) ->defaultOrder(['sort', 'asc']) ->canSort(true) ->hookSaved(function (Form $form) { DocumentUtil::clearCache(); }); } }