|
@@ -0,0 +1,81 @@
|
|
|
+<?php
|
|
|
+namespace App\Admin\Controllers;
|
|
|
+
|
|
|
+use App\Http\Controllers\Controller;
|
|
|
+use App\Model\SymptomKeywords;
|
|
|
+use App\Model\ZskWords;
|
|
|
+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 SymptomKeywordsController 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(SymptomKeywords::class, function (Form $form) {
|
|
|
+ $form->display('id' , '序号');
|
|
|
+ $form->text('keyword' , '症状名称')->required();
|
|
|
+ $form->saving(function (Form $form) {
|
|
|
+ if(is_null($form->parent_id)) {
|
|
|
+ $form->parent_id = 0;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // Grid
|
|
|
+ protected function grid()
|
|
|
+ {
|
|
|
+ return Admin::grid(SymptomKeywords::class, function (Grid $grid) {
|
|
|
+ $grid->id('编号')->sortable();
|
|
|
+ $grid->keyword('症状名称');
|
|
|
+ $grid->created_at('创建时间');
|
|
|
+ $grid->updated_at('更新时间');
|
|
|
+
|
|
|
+ // 禁用导出数据按钮
|
|
|
+ $grid->actions(function ($actions) {
|
|
|
+ $actions->disableView();
|
|
|
+ //$actions->disableEdit();
|
|
|
+ });
|
|
|
+
|
|
|
+ $grid->filter(function($filter){
|
|
|
+
|
|
|
+ // 去掉默认的id过滤器
|
|
|
+ $filter->disableIdFilter();
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|