123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\Banner;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class BannerController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new Banner(), function (Grid $grid) {
- $grid->column('id')->sortable();
- $grid->column('title');
- $grid->column('sort');
- $grid->column('url');
- $grid->column('state')->switch();
- $grid->column('image_path')->image();
- $grid->column('created_at');
- $grid->column('updated_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->like('title');
- $filter->panel();
- });
- $grid->disableViewButton();
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new Banner(), function (Show $show) {
- $show->field('id');
- $show->field('title');
- $show->field('sort');
- $show->field('url');
- $show->field('state');
- $show->field('image_path');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new Banner(), function (Form $form) {
- $form->display('id');
- $form->text('title')->required();
- $form->number('sort')->required();
- $form->text('url')->required()->help('
- 路径: "/pages/index/index"
- 名称: "首页"
- 路径: "/pages/my/index",
- 名称: "我的"
- 路径: "/pages/my/huiBen_record/index",
- 名称: "绘本记录"
- 路径: "/pages/my/charge/index",
- 名称: "充值次数"
- 路径: "/pages/my/userInfo/index",
- 名称: "个人资料"
- 路径: "/pages/index/genHuiBen/index",
- 名称: "绘本生成参数填写页"
- 路径: "/pages/index/genRes/index",
- 名称: "绘本生成结果/绘本详情页"
- 路径: "/pages/my/pubCenter/index",
- 名称: "推广中心"
- 路径: "/pages/my/jiangli/index",
- 名称: "推荐奖励"
- 路径: "/pages/my/tuiguangDashi/index",
- 名称: "推广大使"
- 路径: "/pages/my/yongjinDetail/index",
- 名称: "佣金明细"
- 路径: "/pages/my/cash/index",
- 名称: "提现"
- 路径: "/pages/my/cashRecord/index",
- 名称: "提现记录"
- 路径: "/pages/my/team/index",
- 名称: "推广团队"
- 路径: "/pages/my/kefu/index",
- 名称: "客服中心"
- ');
- $form->switch('state');
- $form->image('image_path')->disk('oss')->autoUpload()->saving(function ($res) {
- return $res;
- })->required();
- $form->display('created_at');
- $form->display('updated_at');
- $form->disableViewButton();
- });
- }
- }
|