update
This commit is contained in:
@@ -387,7 +387,7 @@ class DashboardController extends Controller
|
|||||||
$limit = max(1, min(30, $limit));
|
$limit = max(1, min(30, $limit));
|
||||||
|
|
||||||
// Tổng hợp 3 nguồn rồi sort theo thời gian
|
// 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')
|
->orderByDesc('created_at')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->get()
|
->get()
|
||||||
@@ -405,12 +405,13 @@ class DashboardController extends Controller
|
|||||||
default => 'được tạo',
|
default => 'được tạo',
|
||||||
},
|
},
|
||||||
'description' => ($o->customer->fullname ?? '—') . ' · ' . number_format((float) $o->total, 0, ',', '.') . 'đ',
|
'description' => ($o->customer->fullname ?? '—') . ' · ' . number_format((float) $o->total, 0, ',', '.') . 'đ',
|
||||||
|
'customer_email' => $o->customer->email ?? null,
|
||||||
'created_at' => $o->created_at?->toISOString(),
|
'created_at' => $o->created_at?->toISOString(),
|
||||||
'_ts' => $o->created_at?->timestamp ?? 0,
|
'_ts' => $o->created_at?->timestamp ?? 0,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
$deposits = Transaction::with('customer:id,fullname')
|
$deposits = Transaction::with('customer:id,fullname,email')
|
||||||
->whereIn('type', self::DEPOSIT_TYPES)
|
->whereIn('type', self::DEPOSIT_TYPES)
|
||||||
->orderByDesc('created_at')
|
->orderByDesc('created_at')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
@@ -422,6 +423,7 @@ class DashboardController extends Controller
|
|||||||
'type' => $ok ? 'deposit_success' : 'deposit_failed',
|
'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',
|
'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, ',', '.') . 'đ',
|
'description' => ($t->customer->fullname ?? '—') . ' · ' . number_format((float) $t->amount, 0, ',', '.') . 'đ',
|
||||||
|
'customer_email' => $t->customer->email ?? null,
|
||||||
'created_at' => $t->created_at?->toISOString(),
|
'created_at' => $t->created_at?->toISOString(),
|
||||||
'_ts' => $t->created_at?->timestamp ?? 0,
|
'_ts' => $t->created_at?->timestamp ?? 0,
|
||||||
];
|
];
|
||||||
@@ -435,6 +437,7 @@ class DashboardController extends Controller
|
|||||||
'type' => 'customer_registered',
|
'type' => 'customer_registered',
|
||||||
'title' => 'Khách hàng mới đăng ký',
|
'title' => 'Khách hàng mới đăng ký',
|
||||||
'description' => ($c->fullname ?: $c->email) ?? '—',
|
'description' => ($c->fullname ?: $c->email) ?? '—',
|
||||||
|
'customer_email' => $c->email,
|
||||||
'created_at' => $c->created_at?->toISOString(),
|
'created_at' => $c->created_at?->toISOString(),
|
||||||
'_ts' => $c->created_at?->timestamp ?? 0,
|
'_ts' => $c->created_at?->timestamp ?? 0,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -26,7 +26,11 @@ class EmployeeRepository extends BaseRepository implements EmployeeRepositoryInt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data['role'])) {
|
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;
|
$perPage = $data['per_page'] ?? 15;
|
||||||
|
|||||||
Reference in New Issue
Block a user