123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Admin\Controllers\Market;
- use App\Models\VipCombo;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class VipComboController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new VipCombo(), function (Grid $grid) {
- $grid->model()->orderByDesc('status');
- $grid->column('id')->sortable();
- $grid->column('name')->editable();
- $grid->column('price');
- $grid->column('valid_day');
- $grid->column('desc');
- // $grid->column('status')->switch();
- $grid->disableViewButton();
- $grid->disableDeleteButton();
- $grid->disableRowSelector();
- $grid->disableCreateButton();
- });
- }
- /**
- * Make a show builder.
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new VipCombo(), function (Show $show) {
- $show->field('id');
- $show->field('name');
- $show->field('price');
- $show->field('valid_day');
- $show->field('desc');
- $show->field('status');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new VipCombo(), function (Form $form) {
- $form->display('id');
- $form->text('name')->required();
- $form->decimal('price')->required();
- $form->number('valid_day')->required();
- $form->textarea('desc');
- // $form->switch('status')->default(1);
- $form->disableViewButton();
- $form->disableDeleteButton();
- $form->disableListButton();
- $form->disableEditingCheck();
- $form->disableViewCheck();
- $form->disableCreatingCheck();
- });
- }
- }
|