123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace App\Admin\Controllers\Posts;
- use App\Admin\Repositories\Posts\WxPostsPayContent;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class WxPostsPayContentController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new WxPostsPayContent(), function (Grid $grid) {
- $grid->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('权限不足,不可以删除其他分站对象');
- }
- });
- });
- }
- }
|