fix:refferral
This commit is contained in:
@@ -148,9 +148,11 @@ public function pendingReferralRewards(Request $request)
|
||||
{
|
||||
$target = User::REFERRAL_SUBSCRIPTION_TARGET;
|
||||
|
||||
// Use has() (a correlated subquery in WHERE) rather than having() on the
|
||||
// withCount alias — Postgres does not allow select aliases in HAVING.
|
||||
$users = User::withCount('referrals')
|
||||
->whereNull('referral_subscription_granted_at')
|
||||
->having('referrals_count', '>=', $target)
|
||||
->has('referrals', '>=', $target)
|
||||
->orderByDesc('referrals_count')
|
||||
->get(['id', 'uuid', 'first_name', 'last_name', 'email', 'mobile', 'referral_code']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user