88 lines
2.5 KiB
PHP
88 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Repositories\QuotaV1Log;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
use Dcat\Admin\Show;
|
|
|
|
class QuotaV1LogController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
$builder = QuotaV1Log::with(['user', 'user.userInfo']);
|
|
return Grid::make($builder, function (Grid $grid) {
|
|
$grid->column('id')->sortable();
|
|
$grid->column('user.phone', '手机号')->copyable();
|
|
$grid->column('user.userInfo.nickname', '昵称');
|
|
// $grid->column('loggable_type');
|
|
// $grid->column('loggable_id');
|
|
// $grid->column('action');
|
|
$grid->column('before_balance');
|
|
$grid->column('change_balance');
|
|
$grid->column('remarks');
|
|
$grid->model()->orderBy('created_at', 'desc');
|
|
$grid->column('created_at')->sortable();
|
|
// $grid->column('updated_at')->sortable();
|
|
$grid->disableActions();
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->panel();
|
|
$filter->like('user.phone', '手机号')->width(3);
|
|
// $filter->equal('id');
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
return Show::make($id, new QuotaV1Log(), function (Show $show) {
|
|
$show->field('id');
|
|
$show->field('user_id');
|
|
$show->field('loggable_type');
|
|
$show->field('loggable_id');
|
|
$show->field('action');
|
|
$show->field('before_balance');
|
|
$show->field('change_balance');
|
|
$show->field('remarks');
|
|
$show->field('created_at');
|
|
$show->field('updated_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new QuotaV1Log(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('user_id');
|
|
$form->text('loggable_type');
|
|
$form->text('loggable_id');
|
|
$form->text('action');
|
|
$form->text('before_balance');
|
|
$form->text('change_balance');
|
|
$form->text('remarks');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
});
|
|
}
|
|
}
|