header('政策层次') ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。') ->body($this->grid()); } /** * Show interface. * * @param mixed $id * @param Content $content * @return Content */ public function show($id, Content $content) { return $content ->header('政策层次') ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。') ->body($this->detail($id)); } /** * Edit interface. * * @param mixed $id * @param Content $content * @return Content */ public function edit($id, Content $content) { return $content ->header('政策层次') ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。') ->body($this->editForm()->edit($id)); } /** * Create interface. * * @param Content $content * @return Content */ public function create(Content $content) { return $content ->header('政策层次') ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。') ->body($this->form()); } /** * Make a grid builder. * * @return Grid */ protected function grid() { $grid = new Grid(new PolicyProperty); $grid->id('id'); $grid->categoryname('名称'); $grid->admin_set('类型')->display(function ($admin_set) { if ($admin_set == 1) { return '系统分类'; }else{ return '自定义分类 '; } }); $grid->category_order('排序'); $grid->disableCreateButton(false); $grid->actions(function ($actions) { $actions->disableEdit(false); $actions->disableDelete(false); }); $grid->filter(function ($filter) { $filter->like('categoryname', '名称'); }); return $grid; } /** * Make a show builder. * * @param mixed $id * @return Show */ protected function detail($id) { $show = new Show(PolicyProperty::findOrFail($id)); $show->id('ID'); $show->created_at('Created at'); $show->updated_at('Updated at'); return $show; } /** * Make a form builder. * * @return Form */ protected function form() { $form = new Form(new PolicyProperty); $form->text('categoryname', '名称'); $form->number('category_order', '排序')->default(0)->min(0); $form->hidden('admin_set')->value(0); return $form; } public function update($id) { return $this->editForm()->update($id); } protected function editForm() { $form = new Form(new PolicyProperty); $form->text('categoryname', '名称'); $form->number('category_order', '排序')->default(0)->min(0); return $form; } }