12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace App\Admin\Controllers\User;
- use App\Admin\Repositories\User\WxUserFinancial;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class WxUserFinancialController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new WxUserFinancial('user'), function (Grid $grid) {
- $grid->simplePaginate();
- $grid->model()->orderBy('id', 'desc');
- $grid->column('id')->sortable();
- $grid->column('user.user_avatar', '用户头像')->image('', 50);
- $grid->column('user.user_name', '用户名');
- $grid->column('balance')->label('pink');
- $grid->column('sum_price')->label('primary');
- $grid->column('withdrawal_price')->label('success');
- $grid->column('bank_name');
- $grid->column('bank_card');
- $grid->column('created_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->equal('id');
- });
- // 禁用新增按钮
- $grid->disableCreateButton();
- // 禁用编辑按钮
- $grid->disableEditButton();
- // 禁用详情按钮
- $grid->disableViewButton();
- $grid->disableBatchDelete();
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new WxUserFinancial(), function (Show $show) {
- $show->field('id');
- $show->field('user_id');
- $show->field('balance');
- $show->field('sum_price');
- $show->field('withdrawal_price');
- $show->field('bank_name');
- $show->field('bank_card');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new WxUserFinancial(), function (Form $form) {
- $form->display('id');
- $form->text('user_id');
- $form->text('balance');
- $form->text('sum_price');
- $form->text('withdrawal_price');
- $form->text('bank_name');
- $form->text('bank_card');
- $form->deleting(function (Form $form){
- global $__MINI_GLOBAL_TENANT_ID__;
- if($__MINI_GLOBAL_TENANT_ID__ > 0){
- return $form->response()->error('权限不足,不可以删除其他分站对象');
- }
- });
- });
- }
- }
|