quickSearch(['id', 'name', 'intro'])->placeholder('搜索条款ID,名字,内容等...')->width(30); $grid->column('id')->sortable(); $grid->column('name'); $grid->column('intro'); $grid->column('sort')->editable(); $grid->column('state')->switch(); $grid->column('created_at'); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); }); $grid->disableBatchDelete(); $grid->disableBatchDelete(); // $grid->disableDeleteButton(); $grid->header(function ($collection) { return '
小提示: “不支持7天无理由退货(id:1)”和“7天无理由退货(id:2)”不可以删除,系统自带的也尽量不要删除,因为系统会依据你所选择的服务,做对应的调整,比如不支持7天无理由退货时,则对应的商品就不会出现退货按钮。
'; }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new WxShopService(), function (Show $show) { $show->field('id'); $show->field('name'); $show->field('intro'); $show->field('sort'); $show->field('state'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new WxShopService(), function (Form $form) { $form->display('id'); $form->text('name'); $form->text('intro'); $form->number('sort'); $form->switch('state'); $form->deleting(function (Form $form){ global $__MINI_GLOBAL_TENANT_ID__; if($__MINI_GLOBAL_TENANT_ID__ > 0){ return $form->response()->error('权限不足,不可以删除其他分站对象'); } if($form->id >= 1 && $form->id <= 5){ return $form->response()->error('不能删除1-5的商品服务!'); } }); }); } }