12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\UserVip;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use App\Models\User;
- use Dcat\Admin\Http\Controllers\AdminController;
- class MemberController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new UserVip(), function (Grid $grid) {
- $grid->model()->where('status',1)->orderBy('id','desc');
- $grid->with(['user']);
- $grid->column('id')->sortable();
- $grid->column('user_id','用户')->display(function () {
- return $this->user->nickname;
- });
- $grid->column('order_fee','购买价格');
- $grid->column('pay_at','购买时间');
- $grid->disableDeleteButton();
- $grid->disableCreateButton();
- $grid->disableBatchActions();
- $grid->disableRowSelector();
- $grid->disableActions();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->equal('user.nickname','用户姓名');
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new UserVip(), function (Show $show) {
- $show->field('id');
- $show->field('order_id');
- $show->field('user_id');
- $show->field('prepay_id');
- $show->field('serial_number');
- $show->field('order_fee');
- $show->field('status');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new UserVip(), function (Form $form) {
- $form->display('id');
- $form->text('order_id');
- $form->text('user_id');
- $form->text('prepay_id');
- $form->text('serial_number');
- $form->text('order_fee');
- $form->text('status');
- $form->display('created_at');
- $form->display('updated_at');
- });
- }
- }
|