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(); }); } }