repository(), function (Grid $grid) { $helper = new GridHelper($grid, $this); $helper->columnId(); $helper->columnTitle(); $helper->columnCategory(); $helper->columnStatus(); $helper->columnViewsCount(); $helper->columnIsTop(); $helper->columnIsRecommend(); $helper->columnSortOrder(); $helper->columnCreatedAt(); $helper->columnUpdatedAt(); // 筛选 $grid->filter(function (Grid\Filter $filter) { $helper = new FilterHelper($filter, $this); $helper->equalId(); $helper->likeTitle(); $helper->equalCategory(); $helper->equalStatus(); $helper->equalIsTop(); $helper->equalIsRecommend(); $helper->betweenCreatedAt(); }); // 行操作 $grid->actions(function (Grid\Displayers\Actions $actions) { $actions->disableView(); }); }); } /** * 详情页 * * @param mixed $id * @return Show */ protected function detail($id) { return Show::make($id, new Article(), function (Show $show) { $helper = new ShowHelper($show, $this); $helper->fieldId(); $helper->fieldTitle(); $helper->fieldDescription(); $helper->fieldCategory(); $helper->fieldStatus(); $helper->fieldViewsCount(); $helper->fieldIsTop(); $helper->fieldIsRecommend(); $helper->fieldSortOrder(); $helper->fieldContent(); $helper->fieldCreatedBy(); $helper->fieldCreatedAt(); $helper->fieldUpdatedAt(); }); } /** * 表单 * * @return Form */ protected function form() { return Form::make(Article::class, function (Form $form) { $helper = new FormHelper($form, $this); $helper->textTitle(); $helper->textareaDescription(); $helper->selectCategory(); $helper->selectStatus(); $helper->numberSortOrder(); $helper->switchIsTop(); $helper->switchIsRecommend(); $helper->editorContent(); $helper->hiddenCreatedBy(); }); } }