6
0
Fork 0
jiqu-library-server/app/Admin/Renderable/QuotaV1SendLogTable.php

39 lines
1.2 KiB
PHP

<?php
namespace App\Admin\Renderable;
use App\Models\QuotaV1SendLog;
use Dcat\Admin\Grid;
class QuotaV1SendLogTable extends Grid
{
public static function grid(int $jobId = null)
{
$builder = QuotaV1SendLog::with(['user']);
$grid = parent::make($builder, function (Grid $grid) {
$grid->column('user.phone', '手机号');
$grid->column('amount', '分红金额')->display(function ($value) {
return bcdiv($value, 100, 2);
})->prepend('¥');
$grid->column('status', '状态')->using(QuotaV1SendLog::$statusText)->dot([
0=>'warning',
1=>'success',
]);
$grid->column('created_at', '发放时间')->sortable();
$grid->model()->orderBy('created_at', 'desc');
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->equal('user.phone', '手机号')->width(3);
});
$grid->disableActions();
$grid->disableCreateButton();
});
if ($jobId) {
$grid->model()->where('job_id', $jobId);
}
return $grid;
}
}