| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 | 
							- <?php
 
- namespace App\Admin\Controllers\Content;
 
- use App\Models\PolicyProperty;
 
- use App\Http\Controllers\Controller;
 
- use Encore\Admin\Controllers\HasResourceActions;
 
- use Encore\Admin\Form;
 
- use Encore\Admin\Grid;
 
- use Encore\Admin\Layout\Content;
 
- use Encore\Admin\Show;
 
- class PolicyPropertyController extends Controller
 
- {
 
-     use HasResourceActions;
 
-     
 
-     public function index(Content $content)
 
-     {
 
-         return $content
 
-             ->header('政策层次')
 
-             ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。')
 
-             ->body($this->grid());
 
-     }
 
-     
 
-     public function show($id, Content $content)
 
-     {
 
-         return $content
 
-             ->header('政策层次')
 
-             ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。')
 
-             ->body($this->detail($id));
 
-     }
 
-     
 
-     public function edit($id, Content $content)
 
-     {
 
-         return $content
 
-             ->header('政策层次')
 
-             ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。')
 
-             ->body($this->editForm()->edit($id));
 
-     }
 
-     
 
-     public function create(Content $content)
 
-     {
 
-         return $content
 
-             ->header('政策层次')
 
-             ->description('分类信息谨慎修改,如需修改请提前咨询系统客服。')
 
-             ->body($this->form());
 
-     }
 
-     
 
-     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;
 
-     }
 
-     
 
-     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;
 
-     }
 
-     
 
-     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;
 
-     }
 
- }
 
 
  |