simplePaginate(); $grid->model()->orderBy('id', 'desc'); $grid->quickSearch(['id','post_id','hidden'])->placeholder('搜索id,笔记id,隐藏内容...')->width(50); $grid->column('id')->sortable(); $grid->column('post_id')->sortable(); $grid->column('words_percent')->sortable(); $grid->column('is_file')->sortable(); $grid->column('is_sound')->sortable(); $grid->column('hidden')->limit(30); $grid->column('price')->sortable(); $grid->column('credit_type', '货币类型')->sortable(); $grid->column('created_at')->sortable(); // $grid->column('updated_at')->sortable(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); $filter->equal('post_id'); }); $grid->disableCreateButton(); $grid->disableBatchActions(); $grid->disableDeleteButton(); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new WxPostsPayContent(), function (Show $show) { $show->field('id'); $show->field('post_id'); $show->field('words_percent'); $show->field('is_file'); $show->field('is_sound'); $show->field('hidden'); $show->field('price'); $show->field('credit_type', '货币类型'); $show->field('created_at'); $show->field('updated_at'); $show->disableDeleteButton(); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new WxPostsPayContent(), function (Form $form) { $form->display('id'); $form->text('post_id')->disable(); $form->rate('words_percent'); $form->radio('is_file')->options([0=>'否', 1=>'是']); $form->radio('is_sound')->options([0=>'否', 1=>'是']); $form->textarea('hidden'); $form->text('price'); $form->radio('credit_type', '货币类型')->options([0=>'金币', 1=>'余额']); $form->deleting(function (Form $form){ global $__MINI_GLOBAL_TENANT_ID__; if($__MINI_GLOBAL_TENANT_ID__ > 0){ return $form->response()->error('权限不足,不可以删除其他分站对象'); } }); }); } }