| xqd
@@ -0,0 +1,74 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Admin\Controllers\UserManagement\DocterManagement;
|
|
|
+
|
|
|
+use App\Models\DocterLabel;
|
|
|
+use Encore\Admin\Controllers\AdminController;
|
|
|
+use Encore\Admin\Form;
|
|
|
+use Encore\Admin\Grid;
|
|
|
+use Encore\Admin\Show;
|
|
|
+
|
|
|
+class DocterLabelController extends AdminController
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * Title for current resource.
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $title = '标签管理';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Make a grid builder.
|
|
|
+ *
|
|
|
+ * @return Grid
|
|
|
+ */
|
|
|
+ protected function grid()
|
|
|
+ {
|
|
|
+ $grid = new Grid(new DocterLabel());
|
|
|
+ $grid->actions(function ($actions) {
|
|
|
+ // 去掉查看
|
|
|
+ $actions->disableView();
|
|
|
+ });
|
|
|
+ $grid->column('id', __('Id'));
|
|
|
+ $grid->column('label_name', __('标签名称'));
|
|
|
+ $states = [
|
|
|
+ 'on' => ['value' => 1, 'text' => '启用', 'color' => 'primary'],
|
|
|
+ 'off' => ['value' => 0, 'text' => '禁用', 'color' => 'danger'],
|
|
|
+ ];
|
|
|
+ $grid->column('status', __('状态'))->switch($states);
|
|
|
+
|
|
|
+ return $grid;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Make a show builder.
|
|
|
+ *
|
|
|
+ * @param mixed $id
|
|
|
+ * @return Show
|
|
|
+ */
|
|
|
+ protected function detail($id)
|
|
|
+ {
|
|
|
+ $show = new Show(DocterLabel::findOrFail($id));
|
|
|
+
|
|
|
+ $show->field('id', __('Id'));
|
|
|
+ $show->field('label_name', __('Label name'));
|
|
|
+ $show->field('status', __('Status'));
|
|
|
+
|
|
|
+ return $show;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Make a form builder.
|
|
|
+ *
|
|
|
+ * @return Form
|
|
|
+ */
|
|
|
+ protected function form()
|
|
|
+ {
|
|
|
+ $form = new Form(new DocterLabel());
|
|
|
+
|
|
|
+ $form->text('label_name', __('标签名'));
|
|
|
+ $form->switch('status', __('状态'))->default(1);
|
|
|
+
|
|
|
+ return $form;
|
|
|
+ }
|
|
|
+}
|