quickSearch(['id', 'name', 'description'])->placeholder('搜索头像框ID,名字,描述...'); $grid->model()->orderBy('id', 'desc'); $grid->column('id')->sortable(); $grid->column('name'); $grid->column('image_url')->image('', 50, 50); $grid->column('type')->sortable()->using([0=>'普通', 1=>'会员', 2=>'金币', 3=>'余额'])->label([ 0 => 'primary', 1 => '#f3bc6e', 2 => 'rgb(221, 101, 114)', 3 => 'rgb(1, 192, 170)' ]); $grid->column('price')->sortable(); // $grid->column('description'); $grid->column('quantity')->sortable(); $grid->column('status')->sortable()->radio([0=>'正常', 1=>'已下架']); // $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new WxUserAvatarFrame(), function (Show $show) { $show->field('id'); $show->field('name'); $show->field('image_url'); $show->field('type'); $show->field('price'); $show->field('description'); $show->field('quantity'); $show->field('status'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new WxUserAvatarFrame(), function (Form $form) { $form->display('id'); $form->text('name')->required(); $form->image('image_url')->url('files/uploads')->uniqueName()->autoUpload()->required()->help('点击下载默认图'); $form->radio('type')->options([0=>'普通', 1=>'会员', 2=>'金币', 3=>'余额'])->required()->default(0); $form->text('price')->default(0); $form->textarea('description'); $form->number('quantity')->help('0代表无限制'); $form->radio('status')->options([0=>'正常', 1=>'已下架'])->default(0); $form->display('created_at'); $form->display('updated_at'); $form->deleting(function (Form $form){ global $__MINI_GLOBAL_TENANT_ID__; if($__MINI_GLOBAL_TENANT_ID__ > 0){ return $form->response()->error('权限不足,不可以删除其他分站对象'); } }); }); } }