<?php
 namespace Module\Doc\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Field\AbstractField; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use Module\Doc\Type\DocType; use Module\Doc\Type\DocVisit; use Module\Member\Util\MemberCmsUtil; class DocController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $builder) { $builder ->init('doc') ->field(function ($builder) { $builder->id('id', 'ID'); $builder->datetime('created_at', '创建时间'); $builder->datetime('updated_at', '更新时间'); $builder->display('memberUserId', '用户')->hookRendering(function (AbstractField $field, $item, $index) { return MemberCmsUtil::showFromId($item->memberUserId); }); $builder->type('type', '类型')->type(DocType::class); $builder->type('visit', '访问')->type(DocVisit::class); $builder->display('title', '标题'); }) ->gridFilder(function (GridFilter $filter) { $filter->eq('id', L('ID')); $filter->eq('type', '类型')->select(DocType::class); $filter->eq('visit', '访问')->select(DocType::class); }) ->disableCUD()->canShow(false) ->title('文档管理'); } }