model()->orderBy('id', 'desc'); $grid->column('id')->sortable(); $grid->column('users', '头像')->display(function ($v) { return ''; })->width('50px'); $grid->column('user')->display(function ($v) { if($v && $v['user_name']){ return ''.$v['user_name'].'' ?? '用户已删除'; } return '用户已删除'; })->width('100px'); $grid->column('pet_adoption_id'); $grid->column('comment_id'); $grid->column('comment_agent_id'); $grid->column('comment_agent_name'); $grid->column('comment_content')->limit(40); $grid->column('comment_img_url')->image('', 60, 60); // $grid->column('longitude'); // $grid->column('latitude'); // $grid->column('ip'); // $grid->column('country'); // $grid->column('province'); // $grid->column('city'); // $grid->column('district'); $grid->column('comment_state', '状态')->using([0 => '待审核', 1 => '审核通过', 2 => '驳回'])->label([ 0 => 'red', 1 => 'green', 2 => 'default' ]); // $grid->column('created_at'); $grid->column('updated_at')->sortable(); $grid->filter(function (Grid\Filter $filter) { $filter->equal('id'); }); $grid->batchActions(function ($batch) { $batch->add(new PetsCommentsPassAction()); }); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new WxPetsComment(), function (Show $show) { $show->field('id'); $show->field('user_id'); $show->field('pet_adoption_id'); $show->field('comment_id'); $show->field('comment_agent_id'); $show->field('comment_agent_name'); $show->field('comment_content'); $show->field('comment_img_url'); $show->field('longitude'); $show->field('latitude'); $show->field('ip'); $show->field('country'); $show->field('province'); $show->field('city'); $show->field('district'); $show->field('comment_state'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new WxPetsComment(), function (Form $form) { $form->display('id'); $form->text('user_id'); $form->text('pet_adoption_id'); $form->text('comment_id'); $form->text('comment_agent_id'); $form->text('comment_agent_name'); $form->text('comment_content'); $form->text('comment_img_url'); $form->text('longitude'); $form->text('latitude'); $form->text('ip'); $form->text('country'); $form->text('province'); $form->text('city'); $form->text('district'); $form->text('comment_state'); $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('权限不足,不可以删除其他分站对象'); } }); }); } }