48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers\Account;
|
|
|
|
use App\Models\Account;
|
|
use App\Models\User;
|
|
use Encore\Admin\Controllers\AdminController;
|
|
use Encore\Admin\Grid;
|
|
|
|
class IndexController extends AdminController
|
|
{
|
|
|
|
protected $title = '账户管理';
|
|
|
|
protected function grid()
|
|
{
|
|
$grid = new Grid(new Account);
|
|
|
|
$grid->model()->whereHasMorph(
|
|
'accountable',
|
|
User::class,
|
|
function ($query) {
|
|
$query->where('type', 'pingan')->whereHas('identity', function ($q) {
|
|
$q->where('identity_id', 1);
|
|
});
|
|
}
|
|
);
|
|
|
|
$grid->disableActions();
|
|
$grid->disableCreateButton();
|
|
// $grid->column('所属项目')->display(function () {
|
|
// return $this->accountable->type_text;
|
|
// });
|
|
$grid->column('渠道名称')->display(function () {
|
|
return $this->accountable->name ?? $this->accountable->nickname;
|
|
});
|
|
$grid->column('balance', '总分润');
|
|
$grid->column('score', '已打款');
|
|
// $grid->column('updated_at', '更新时间');
|
|
$grid->column('日志')->display(function () {
|
|
return '<a href="' . admin_url('accounts/logs?id=' . $this->id) . '">账户日志</a>';
|
|
});
|
|
|
|
return $grid;
|
|
}
|
|
|
|
}
|