You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Admin\Controllers\v3;
use App\Admin\Repositories\v3\CouponSetting;use Dcat\Admin\Form;use Dcat\Admin\Grid;use Dcat\Admin\Show;use Dcat\Admin\Controllers\AdminController;use App\Models\v3\CouponSetting as SettingModel;
class CouponSettingController extends AdminController{ /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new CouponSetting(), function (Grid $grid) { $grid->id->sortable(); $grid->category_text; $grid->name; $grid->value; $grid->sort; $grid->status->switch();
$grid->model()->orderBy('id','desc'); $grid->filter(function (Grid\Filter $filter) { $filter->like('name'); }); }); }
/** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new CouponSetting(), function (Show $show) { $show->row(function (Show\Row $show) { $show->width(6)->id; $show->width(6)->category_text; $show->width(6)->name; $show->width(6)->value; }); $show->row(function (Show\Row $show) { $show->width(6)->sort; $show->width(6)->status_text; $show->width(6)->created_at; $show->width(6)->updated_at; }); // $show->desc;
}); }
/** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new CouponSetting(), function (Form $form) { $form->hidden('id'); $form->select('category')->width(6)->options(SettingModel::$category); $form->text('name')->width(6)->required()->maxLength(50); $form->number('value')->required()->rules('min:1')->default(1); // $form->text('desc')->maxLength(500);
$form->number('sort')->rules('min:0');
$form->disableResetButton(); $form->disableViewCheck(); $form->disableEditingCheck(); $form->disableCreatingCheck(); }); }}
|