diff --git a/app/Admin/Controllers/ConfigController.php b/app/Admin/Controllers/ConfigController.php new file mode 100644 index 0000000..80970fd --- /dev/null +++ b/app/Admin/Controllers/ConfigController.php @@ -0,0 +1,106 @@ +withBorder(); + // 开启字段选择器功能 + $grid->showColumnSelector(); + + $grid->model()->where("unique_identification", "annual_session"); + + $grid->column('id')->sortable(); + $grid->column('data'); + $grid->column('remark'); + $grid->column('create_time'); + $grid->column('update_time'); + + + $grid->filter(function (Grid\Filter $filter) { + $filter->equal('id'); + + }); + + // 禁用创建按钮 + $grid->disableCreateButton(); + // 禁用删除按钮 + $grid->disableDeleteButton(); + //禁用批量操作按钮 + $grid->disableBatchDelete(); + + // 禁用详情按钮 + $grid->disableViewButton(); + }); + } + + /** + * Make a show builder. + * + * @param mixed $id + * + * @return Show + */ + protected function detail($id) + { + return Show::make($id, new Config(), function (Show $show) { + $show->field('id'); + $show->field('unique_identification'); + $show->field('data'); + $show->field('create_time'); + $show->field('update_time'); + $show->field('remark'); + $show->field('created_at'); + $show->field('updated_at'); + }); + } + + /** + * Make a form builder. + * + * @return Form + */ + protected function form() + { + return Form::make(new Config(), function (Form $form) { + $form->display('id'); + $form->hidden('unique_identification'); + $form->text('data')->required(); + $form->text('remark')->required(); + + // 去除删除按钮 + $form->disableDeleteButton(); + // 去除跳转详情按钮 + $form->disableViewButton(); + + $form->footer(function ($footer) { + + // 去掉`查看`checkbox + $footer->disableViewCheck(); + + // 去掉`继续编辑`checkbox + $footer->disableEditingCheck(); + + // 去掉`继续创建`checkbox + $footer->disableCreatingCheck(); + + }); + + }); + } +} diff --git a/app/Admin/routes.php b/app/Admin/routes.php index ac6a804..0202fe0 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -38,4 +38,5 @@ Route::group([ $router->resource("/wechat_app_config", "WechatAppConfigController"); $router->resource("/security_user", "SecurityUserController"); $router->resource("/loan_students_list", "LoanStudentsListController"); + $router->resource("/config_list", "ConfigController"); }); diff --git a/app/Models/Config.php b/app/Models/Config.php index 8f8baf9..6ef698c 100644 --- a/app/Models/Config.php +++ b/app/Models/Config.php @@ -10,6 +10,26 @@ class Config extends Model { use HasDateTimeFormatter; protected $table = 'config'; - public $timestamps = false; + const CREATED_AT = 'create_time'; + const UPDATED_AT = 'update_time'; + public $timestamps = true; + + public function freshTimestamp() + { + return time(); + } + + + /*避免转换时间戳为时间字符串*/ + public function fromDateTime($value) + { + return $value; + } + + + protected function serializeDate(\DateTimeInterface $date) + { + return $date->format('Y-m-d H:i:s'); + } } diff --git a/dcat_admin_ide_helper.php b/dcat_admin_ide_helper.php index 0a194a2..5c700f0 100644 --- a/dcat_admin_ide_helper.php +++ b/dcat_admin_ide_helper.php @@ -93,6 +93,9 @@ namespace Dcat\Admin { * @property Grid\Column|Collection bed_number * @property Grid\Column|Collection building_title * @property Grid\Column|Collection teacher_id + * @property Grid\Column|Collection conllege_name + * @property Grid\Column|Collection idcard + * @property Grid\Column|Collection speciality_name * @property Grid\Column|Collection data * @property Grid\Column|Collection remark * @property Grid\Column|Collection unique_identification @@ -137,7 +140,6 @@ namespace Dcat\Admin { * @property Grid\Column|Collection dormitory_type_id * @property Grid\Column|Collection people * @property Grid\Column|Collection dormitory_id - * @property Grid\Column|Collection idcard * @property Grid\Column|Collection multiple_id * @property Grid\Column|Collection is_must * @property Grid\Column|Collection amounts_price @@ -208,7 +210,6 @@ namespace Dcat\Admin { * @property Grid\Column|Collection titleKey * @property Grid\Column|Collection sms_id * @property Grid\Column|Collection secondary_college_id - * @property Grid\Column|Collection speciality_name * @property Grid\Column|Collection login_ip * @property Grid\Column|Collection uid * @property Grid\Column|Collection belongto @@ -319,6 +320,9 @@ namespace Dcat\Admin { * @method Grid\Column|Collection bed_number(string $label = null) * @method Grid\Column|Collection building_title(string $label = null) * @method Grid\Column|Collection teacher_id(string $label = null) + * @method Grid\Column|Collection conllege_name(string $label = null) + * @method Grid\Column|Collection idcard(string $label = null) + * @method Grid\Column|Collection speciality_name(string $label = null) * @method Grid\Column|Collection data(string $label = null) * @method Grid\Column|Collection remark(string $label = null) * @method Grid\Column|Collection unique_identification(string $label = null) @@ -363,7 +367,6 @@ namespace Dcat\Admin { * @method Grid\Column|Collection dormitory_type_id(string $label = null) * @method Grid\Column|Collection people(string $label = null) * @method Grid\Column|Collection dormitory_id(string $label = null) - * @method Grid\Column|Collection idcard(string $label = null) * @method Grid\Column|Collection multiple_id(string $label = null) * @method Grid\Column|Collection is_must(string $label = null) * @method Grid\Column|Collection amounts_price(string $label = null) @@ -434,7 +437,6 @@ namespace Dcat\Admin { * @method Grid\Column|Collection titleKey(string $label = null) * @method Grid\Column|Collection sms_id(string $label = null) * @method Grid\Column|Collection secondary_college_id(string $label = null) - * @method Grid\Column|Collection speciality_name(string $label = null) * @method Grid\Column|Collection login_ip(string $label = null) * @method Grid\Column|Collection uid(string $label = null) * @method Grid\Column|Collection belongto(string $label = null) @@ -550,6 +552,9 @@ namespace Dcat\Admin { * @property Show\Field|Collection bed_number * @property Show\Field|Collection building_title * @property Show\Field|Collection teacher_id + * @property Show\Field|Collection conllege_name + * @property Show\Field|Collection idcard + * @property Show\Field|Collection speciality_name * @property Show\Field|Collection data * @property Show\Field|Collection remark * @property Show\Field|Collection unique_identification @@ -594,7 +599,6 @@ namespace Dcat\Admin { * @property Show\Field|Collection dormitory_type_id * @property Show\Field|Collection people * @property Show\Field|Collection dormitory_id - * @property Show\Field|Collection idcard * @property Show\Field|Collection multiple_id * @property Show\Field|Collection is_must * @property Show\Field|Collection amounts_price @@ -665,7 +669,6 @@ namespace Dcat\Admin { * @property Show\Field|Collection titleKey * @property Show\Field|Collection sms_id * @property Show\Field|Collection secondary_college_id - * @property Show\Field|Collection speciality_name * @property Show\Field|Collection login_ip * @property Show\Field|Collection uid * @property Show\Field|Collection belongto @@ -776,6 +779,9 @@ namespace Dcat\Admin { * @method Show\Field|Collection bed_number(string $label = null) * @method Show\Field|Collection building_title(string $label = null) * @method Show\Field|Collection teacher_id(string $label = null) + * @method Show\Field|Collection conllege_name(string $label = null) + * @method Show\Field|Collection idcard(string $label = null) + * @method Show\Field|Collection speciality_name(string $label = null) * @method Show\Field|Collection data(string $label = null) * @method Show\Field|Collection remark(string $label = null) * @method Show\Field|Collection unique_identification(string $label = null) @@ -820,7 +826,6 @@ namespace Dcat\Admin { * @method Show\Field|Collection dormitory_type_id(string $label = null) * @method Show\Field|Collection people(string $label = null) * @method Show\Field|Collection dormitory_id(string $label = null) - * @method Show\Field|Collection idcard(string $label = null) * @method Show\Field|Collection multiple_id(string $label = null) * @method Show\Field|Collection is_must(string $label = null) * @method Show\Field|Collection amounts_price(string $label = null) @@ -891,7 +896,6 @@ namespace Dcat\Admin { * @method Show\Field|Collection titleKey(string $label = null) * @method Show\Field|Collection sms_id(string $label = null) * @method Show\Field|Collection secondary_college_id(string $label = null) - * @method Show\Field|Collection speciality_name(string $label = null) * @method Show\Field|Collection login_ip(string $label = null) * @method Show\Field|Collection uid(string $label = null) * @method Show\Field|Collection belongto(string $label = null) diff --git a/resources/lang/zh_CN/config.php b/resources/lang/zh_CN/config.php index ac490ef..d09a8f4 100644 --- a/resources/lang/zh_CN/config.php +++ b/resources/lang/zh_CN/config.php @@ -1,4 +1,4 @@ - [ 'Config' => '配置文件', @@ -6,7 +6,7 @@ return [ ], 'fields' => [ 'unique_identification' => '标识--字段名', - 'data' => '数据--值', + 'data' => '数据', 'create_time' => '创建时间', 'update_time' => '修改时间', 'remark' => '备注',