12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace App\Admin\Controllers;
- use App\Http\Controllers\Controller;
- use App\Model\DiseaseKeyword;
- use Encore\Admin\Form;
- use Encore\Admin\Grid;
- use Encore\Admin\Facades\Admin;
- use Encore\Admin\Layout\Content;
- use Encore\Admin\Controllers\ModelForm;
- use function Clue\StreamFilter\fun;
- class DiseasesKeywordController extends Controller
- {
- use ModelForm;
- public function index()
- {
- return Admin::content(function (Content $content) {
- $content->header('疾病关键字');
- $content->description('列表');
- $content->body($this->grid());
- });
- }
- public function create()
- {
- return Admin::content(function (Content $content) {
- $content->header('疾病关键字');
- $content->description('新增');
- $content->body($this->form());
- });
- }
- public function edit($id)
- {
- return Admin::content(function (Content $content) use ($id) {
- $content->header('疾病关键字');
- $content->description('列表');
- $content->body($this->form($id)->edit($id));
- });
- }
- protected function form($id = '')
- {
- return Admin::form(DiseaseKeyword::class, function (Form $form) {
- $form->display('id' , '序号');
- $form->text('keyword' , '关键字')->required();
- $form->select('tag' , '分类')->options([1 => '幼儿' , 2 => '老年人' , 3 => '男' , 4 => '女'])->required();
- $form->text('remark' , '备注')->required();
- });
- }
-
- protected function grid()
- {
- return Admin::grid(DiseaseKeyword::class, function (Grid $grid) {
- $grid->id('编号')->sortable();
- $grid->keyword('关键字');
- $grid->remark('备注');
- $grid->tag('分类');
- $grid->created_at('创建时间');
- $grid->updated_at('更新时间');
-
- $grid->actions(function ($actions) {
- $actions->disableView();
-
- });
- $grid->filter(function($filter){
-
- $filter->disableIdFilter();
-
-
- });
- });
- }
- }
|