12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace App\Admin\Controllers;
- use App\Models\UserRechargeRecord;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class UserRechargeRecordController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new UserRechargeRecord(), function (Grid $grid) {
- $grid->column('id')->sortable();
- $grid->column('user_id')->display(function (){
- return $this->user->nickname;
- });
- $grid->column('combo_id')->display(function (){
- return $this->combo->name;
- });
- $grid->column('price');
- $grid->column('gift');
- $grid->column('pay_id');
- $grid->column('created_at');
- $grid->column('updated_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->equal('user_id');
- $filter->equal('price');
- $filter->equal('created_at')->date();
- });
- $grid->disableCreateButton();
- $grid->disableDeleteButton();
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new UserRechargeRecord(), function (Show $show) {
- $show->field('id');
- $show->field('user_id');
- $show->field('combo_id');
- $show->field('price');
- $show->field('gift');
- $show->field('pay_id');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new UserRechargeRecord(), function (Form $form) {
- $form->display('id');
- $form->text('user_id');
- $form->text('combo_id');
- $form->text('price');
- $form->text('gift');
- $form->text('pay_id');
- $form->display('created_at');
- $form->display('updated_at');
- });
- }
- }
|