| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace App\Admin\Controllers;
- use App\Admin\Repositories\Account;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class AccountController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new Account(), function (Grid $grid) {
- $grid->column('id')->sortable();
- $grid->column('avatar','用户头像')->image(config("filesystems.disks.cosv5.url"), 60, 60);;
- $grid->column('username');
- $grid->column('coupon')->display(function($v) {
- return $v.' <a href="/admin/coupon_records?account_id='.$this->id.'" target="_blank">查看明细</a>';
- });
- $grid->column('box_record','开盒记录')->display(function($v) {
- return '<a href="/admin/box_records?account_id='.$this->id.'" target="_blank">点击查看</a>';
- });
- $grid->column('paster');
- $grid->column('uid','uid')->help("B站用户ID");
- $grid->column('created_at');
- $grid->column('updated_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->panel();
- $filter->expand();
- $filter->equal('uid','用户UID')->width(2);
- $filter->like('name','用户名称')->width(2);
- });
- $grid->disableCreateButton();
- $grid->enableDialogCreate();
- $grid->setDialogFormDimensions('40%', '50%');
- $grid->withBorder();
- $grid->actions(function (Grid\Displayers\Actions $actions) {
- $actions->quickEdit(true);
- $actions->disableEdit();
- $actions->disableView();
- });
- $grid->tools(function (Grid\Tools $tools) {
- $tools->append(new \App\Admin\Actions\Grid\NewUserCouponAction());
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new Account(), function (Show $show) {
- $show->field('id');
- $show->field('username');
- $show->field('coupon');
- $show->field('paster');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new Account(), function (Form $form) {
- // $form->display('id');
- $form->text('username');
- $form->number('coupon');
- $form->number('paster');
- //
- // $form->display('created_at');
- // $form->display('updated_at');
- });
- }
- }
|