This commit is contained in:
baodev0
2026-10-20 09:58:38 +07:00
parent 25f23d541e
commit 94b11a7f18
2 changed files with 10 additions and 3 deletions
@@ -387,7 +387,7 @@ class DashboardController extends Controller
$limit = max(1, min(30, $limit));
// Tổng hợp 3 nguồn rồi sort theo thời gian
$orders = Order::with('customer:id,fullname')
$orders = Order::with('customer:id,fullname,email')
->orderByDesc('created_at')
->limit($limit)
->get()
@@ -405,12 +405,13 @@ class DashboardController extends Controller
default => 'được tạo',
},
'description' => ($o->customer->fullname ?? '—') . ' · ' . number_format((float) $o->total, 0, ',', '.') . 'đ',
'customer_email' => $o->customer->email ?? null,
'created_at' => $o->created_at?->toISOString(),
'_ts' => $o->created_at?->timestamp ?? 0,
];
});
$deposits = Transaction::with('customer:id,fullname')
$deposits = Transaction::with('customer:id,fullname,email')
->whereIn('type', self::DEPOSIT_TYPES)
->orderByDesc('created_at')
->limit($limit)
@@ -422,6 +423,7 @@ class DashboardController extends Controller
'type' => $ok ? 'deposit_success' : 'deposit_failed',
'title' => $ok ? 'Nạp tiền thành công' : 'Giao dịch nạp thất bại',
'description' => ($t->customer->fullname ?? '—') . ' · ' . number_format((float) $t->amount, 0, ',', '.') . 'đ',
'customer_email' => $t->customer->email ?? null,
'created_at' => $t->created_at?->toISOString(),
'_ts' => $t->created_at?->timestamp ?? 0,
];
@@ -435,6 +437,7 @@ class DashboardController extends Controller
'type' => 'customer_registered',
'title' => 'Khách hàng mới đăng ký',
'description' => ($c->fullname ?: $c->email) ?? '—',
'customer_email' => $c->email,
'created_at' => $c->created_at?->toISOString(),
'_ts' => $c->created_at?->timestamp ?? 0,
]);
@@ -26,7 +26,11 @@ class EmployeeRepository extends BaseRepository implements EmployeeRepositoryInt
}
if (!empty($data['role'])) {
$query->whereHas('roles', fn($q) => $q->where('name', $data['role']));
$query->whereHas('roles', fn($q) => $q->whereIn('name', (array) $data['role']));
}
if (isset($data['status']) && $data['status'] !== []) {
$query->whereIn('status', (array) $data['status']);
}
$perPage = $data['per_page'] ?? 15;