mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-15 04:10:51 +08:00
feat: enhance plan user statistics with active user count display
This commit is contained in:
@@ -18,7 +18,15 @@ class PlanController extends Controller
|
||||
->with([
|
||||
'group:id,name'
|
||||
])
|
||||
->withCount('users')
|
||||
->withCount([
|
||||
'users',
|
||||
'users as active_users_count' => function ($query) {
|
||||
$query->where(function ($q) {
|
||||
$q->where('expired_at', '>', time())
|
||||
->orWhereNull('expired_at');
|
||||
});
|
||||
}
|
||||
])
|
||||
->get();
|
||||
|
||||
return $this->success($plans);
|
||||
|
||||
Reference in New Issue
Block a user