| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace App\Module\Game\AdminControllers;
- use App\Module\Game\Models\UserLogClearRecord;
- use UCore\DcatAdmin\AdminController;
- use UCore\DcatAdmin\Grid;
- use UCore\DcatAdmin\Show;
- use UCore\DcatAdmin\Form;
- /**
- * 用户日志清理记录管理控制器
- *
- * 路由: /admin/game/user-log-clear-records
- */
- class UserLogClearRecordController extends AdminController
- {
- /**
- * 页面标题
- *
- * @var string
- */
- protected $title = '用户日志清理记录';
- /**
- * 列表页面
- *
- * @return Grid
- */
- protected function grid(): Grid
- {
- $grid = Grid::make(UserLogClearRecord::query()->latest(), function (Grid $grid) {
- $grid->column('id', 'ID')->sortable();
- $grid->column('user_id', '用户ID')->sortable();
- $grid->column('cleared_at', '清理时间')->sortable();
- $grid->column('created_at', '创建时间')->sortable();
- $grid->column('updated_at', '更新时间')->sortable();
- // 过滤器
- $grid->filter(function (Grid\Filter $filter) {
- $filter->equal('user_id', '用户ID');
- $filter->between('cleared_at', '清理时间')->datetime();
- $filter->between('created_at', '创建时间')->datetime();
- });
- // 禁用创建按钮
- $grid->disableCreateButton();
-
- // 禁用编辑和删除操作
- $grid->disableActions();
-
- // 只保留查看操作
- $grid->actions(function (Grid\Displayers\Actions $actions) {
- $actions->disableEdit();
- $actions->disableDelete();
- });
- });
- return $grid;
- }
- /**
- * 详情页面
- *
- * @return Show
- */
- protected function detail(): Show
- {
- return Show::make(UserLogClearRecord::query(), function (Show $show) {
- $show->field('id', 'ID');
- $show->field('user_id', '用户ID');
- $show->field('cleared_at', '清理时间');
- $show->field('created_at', '创建时间');
- $show->field('updated_at', '更新时间');
- });
- }
- /**
- * 表单页面(禁用)
- *
- * @return Form
- */
- protected function form(): Form
- {
- return Form::make(UserLogClearRecord::query(), function (Form $form) {
- $form->display('id', 'ID');
- $form->display('user_id', '用户ID');
- $form->display('cleared_at', '清理时间');
- $form->display('created_at', '创建时间');
- $form->display('updated_at', '更新时间');
-
- // 禁用所有操作
- $form->disableCreatingCheck();
- $form->disableEditingCheck();
- $form->disableViewCheck();
- });
- }
- }
|