点数流转 * 功能: 查看用户种植点数账户间的流转记录 */ #[Resource('point-point-circulation', names: 'admin.point.point-circulation', except: ['create', 'store', 'edit', 'update', 'destroy'])] class PointCirculationController extends AdminController { /** * 数据仓库 */ protected string $repository = PointCirculationRepository::class; /** * 页面标题 */ protected $title = '点数流转'; /** * 列表页面 */ protected function grid(): Grid { return Grid::make(new PointCirculationRepository(), function (Grid $grid) { $gridHelper = new GridHelper($grid,$this); $grid->column('id', 'ID')->sortable(); $gridHelper->columnCirculationInfo(); $gridHelper->columnPoints('amount', '流转积分'); $grid->column('re_type', '关联类型'); $grid->column('re_id', '关联ID'); $gridHelper->columnStatus(); $grid->column('remark', '备注')->limit(30); $gridHelper->columnTimestamp('create_time', '创建时间'); $grid->filter(function (Grid\Filter $filter) { $filterHelper = new FilterHelper($filter,$this); $filterHelper->equalUserId(); $filter->equal('from_point_id', '源积分类型')->select([ 1 => '经验积分', 2 => '成就积分', 3 => '活动积分', 4 => '签到积分', 5 => '推荐积分', ]); $filter->equal('to_point_id', '目标积分类型')->select([ 1 => '经验积分', 2 => '成就积分', 3 => '活动积分', 4 => '签到积分', 5 => '推荐积分', ]); $filterHelper->equalReType(); $filterHelper->equalStatus(); $filterHelper->betweenTimestamp('create_time', '创建时间'); $filterHelper->likeRemark(); }); $grid->disableCreateButton(); $grid->disableEditButton(); $grid->disableDeleteButton(); $grid->actions(function (Grid\Displayers\Actions $actions) { $actions->disableEdit(); $actions->disableDelete(); }); $grid->tools(function (Grid\Tools $tools) { $tools->append('用户积分'); }); }); } /** * 详情页面 */ protected function detail($id): Show { return Show::make($id, new PointCirculationRepository(), function (Show $show) { $showHelper = new ShowHelper($show,$this); $show->field('id', 'ID'); $showHelper->fieldCirculationInfo(); $showHelper->fieldPoints('amount', '流转积分'); $show->field('re_type', '关联类型'); $show->field('re_id', '关联ID'); $showHelper->fieldStatus(); $show->field('remark', '备注'); $showHelper->fieldTimestamp('create_time', '创建时间'); $showHelper->fieldTimestamp('update_time', '更新时间'); $show->disableEditButton(); $show->disableDeleteButton(); }); } /** * 禁用表单页面 */ protected function form() { return redirect()->back()->with('error', '积分流转记录不允许编辑'); } }