| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 | 
							- <?php
 
- namespace App\Admin\Controllers\Jobfair;
 
- use App\Http\Controllers\Controller;
 
- use App\Models\Jobfair\JobfairManagement;
 
- use Encore\Admin\Controllers\HasResourceActions;
 
- use Encore\Admin\Facades\Admin;
 
- use Encore\Admin\Form;
 
- use Encore\Admin\Grid;
 
- use Encore\Admin\Layout\Content;
 
- use Encore\Admin\Show;
 
- class JobfairManagementController extends Controller
 
- {
 
-     use HasResourceActions;
 
-     /**
 
-      * Index interface.
 
-      *
 
-      * @param Content $content
 
-      * @return Content
 
-      */
 
-     public function index(Content $content)
 
-     {
 
-         return $content
 
-             ->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->createForm());
 
-     }
 
-     /**
 
-      * Make a grid builder.
 
-      *
 
-      * @return Grid
 
-      */
 
-     protected function grid()
 
-     {
 
-         $grid = new Grid(new JobfairManagement);
 
-         $grid->model()->orderBy('id', 'desc');
 
-         $grid->name('名称')->width(200);
 
-         $grid->created_at('创建时间');
 
-         $grid->updated_at('更新时间');
 
-         $grid->actions(function ($actions) use ($grid) {
 
-             if (Admin::user()->can('jobfair_type_manager_edit')) {
 
-                 $actions->disableEdit(false);
 
-             }
 
-             if (Admin::user()->can('jobfair_type_manager_delete')) {
 
-                 $actions->disableDelete(false);
 
-             }
 
-         });
 
-         if (Admin::user()->can('jobfair_type_manager_delete')) {
 
-             $grid->tools(function ($tools) {
 
-                 $tools->batch(function ($batch) {
 
-                     $batch->disableDelete(false);
 
-                 });
 
-             });
 
-             $grid->disableRowSelector(false);
 
-         }
 
-         $grid->filter(function ($filter) {
 
-             $filter->like('name', '分类名称');
 
-         });
 
-         if (Admin::user()->can('jobfair_type_manager_create')) {
 
-             $grid->disableCreateButton(false);
 
-         }
 
-         return $grid;
 
-     }
 
-     /**
 
-      * Make a show builder.
 
-      *
 
-      * @param mixed $id
 
-      * @return Show
 
-      */
 
-     protected function detail($id)
 
-     {
 
-         $show = new Show(JobfairManagement::findOrFail($id));
 
-         $show->id('ID');
 
-         $show->name('名称');
 
-         $show->created_at('创建时间');
 
-         $show->updated_at('更新时间');
 
-         return $show;
 
-     }
 
-     /**
 
-      * Make a form builder.
 
-      *
 
-      * @return Form
 
-      */
 
-     protected function form()
 
-     {
 
-         $form = new Form(new JobfairManagement);
 
-         $form->display('ID');
 
-         $form->display('Created at');
 
-         $form->display('Updated at');
 
-         return $form;
 
-     }
 
-     /**
 
-      * Make a form builder.
 
-      *
 
-      * @return Form
 
-      */
 
-     protected function editForm()
 
-     {
 
-         $form = new Form(new JobfairManagement);
 
-         $form->text('name', '名称')->rules([
 
-             'required',
 
-         ]);
 
-         $form->number('order_list', '排序')->min(0)->help('数字越大,越靠前!');
 
-         return $form;
 
-     }
 
-     protected function createForm()
 
-     {
 
-         $form = new Form(new JobfairManagement);
 
-         $form->text('name', '名称')->rules([
 
-             'required',
 
-         ])->setMustMark();
 
-         $form->number('order_list', '排序')->min(0)->help('数字越大,越靠前!');
 
-         return $form;
 
-     }
 
-     /**
 
-      * Store a newly created resource in storage.
 
-      *
 
-      * @return mixed
 
-      */
 
-     public function store()
 
-     {
 
-         return $this->createForm()->store();
 
-     }
 
-     /**
 
-      * Update the specified resource in storage.
 
-      *
 
-      * @param int $id
 
-      *
 
-      * @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
 
-      */
 
-     public function update($id)
 
-     {
 
-         return $this->editForm()->update($id);
 
-     }
 
- }
 
 
  |