| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\Admin\Controllers;
- use App\Admin\Repositories\LiveRoom;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class LiveRoomController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new LiveRoom(), function (Grid $grid) {
- $grid->column('id')->sortable();
- $grid->column('name');
- $grid->column('img')->image(config("filesystems.disks.cosv5.url"),60,60);
- $grid->column('short_name');
- $grid->column('medal_name');
- $grid->column('room_id');
- $grid->column('sort')->editable(true);
- $grid->column('is_show_share')->using(['隐藏','显示']);
- // $grid->column('created_at');
- $grid->column('updated_at')->sortable();
-
- $grid->enableDialogCreate();
- $grid->setDialogFormDimensions('50%', '60%');
- $grid->withBorder();
- $grid->actions(function (Grid\Displayers\Actions $actions) {
- $actions->quickEdit(true);
- $actions->disableEdit();
- $actions->disableView();
- });
- $grid->model()->orderBy("sort","asc")->orderBy("id","asc");
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new LiveRoom(), function (Show $show) {
- $show->field('id');
- $show->field('name');
- $show->field('img');
- $show->field('short_name');
- $show->field('room_id');
- $show->field('sort');
- $show->field('is_show_share');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new LiveRoom(), function (Form $form) {
- // $form->display('id');
- $form->text('name')->required();
- $form->image('img')->autoUpload()->removable(false)->autoSave(false)->uniqueName()->required();
- $form->text('short_name')->required();
- $form->text('medal_name');
- $form->text('room_id')->required();
- $form->number('sort')->default(0)->help("显示的顺序,默认从小到大显示");
- $form->switch('is_show_share')->help("用来控制在H5页面的试衣间上传皮肤后的弹窗中是否显示");
-
- });
- }
- }
|