<?php
 namespace Module\Paper\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Concern\HasAdminQuickCRUD; use ModStart\Admin\Layout\AdminCRUDBuilder; use ModStart\Core\Input\Response; use ModStart\Grid\GridFilter; use ModStart\Support\Concern\HasFields; use Module\Paper\Util\PaperCategoryUtil; class PaperCategoryController extends Controller { use HasAdminQuickCRUD; protected function crud(AdminCRUDBuilder $builder) { $builder ->init('paper_category') ->field(function ($builder) { $builder->id('id', 'ID'); $builder->text('name', '名称'); $builder->display('created_at', L('Created At'))->listable(false); $builder->display('updated_at', L('Updated At'))->listable(false); }) ->gridFilder(function (GridFilter $filter) { $filter->eq('id', L('ID')); $filter->like('name', L('Title')); }) ->canShow(false) ->title('试卷分类') ->asTree() ->treeMaxLevel(1); } public function all() { return Response::jsonSuccessData(PaperCategoryUtil::all()); } }