tahesab 3

This commit is contained in:
2026-06-07 19:23:03 +03:30
parent 484f05a073
commit c849fd6755
2 changed files with 30 additions and 8 deletions
@@ -181,9 +181,21 @@ class CustomerController extends SuperController
$companyName = $this->Config('name_fa');
$companyurl = $this->Config('app_url');
$total_referrals = Customer::where('referral_to_id', $referrer->referral_id)->where('is_legal', '!=', 0)->get()->count();
$referral_limit = Setting::where('key', 'referral_limit')->first();
$gift_permision = $referral_limit->is_active ? $total_referrals < $referral_limit->value ? true : false : true ;
$limitValue = $referral_limit->value ?? null;
$gift_permision = true;
if (
$referral_limit
&& $referral_limit->is_active
&& $limitValue !== null
&& $limitValue !== ''
&& is_numeric($limitValue)
) {
$total_referrals = Customer::where('referral_to_id', $referrer->referral_id)
->where('is_legal', '!=', 0)
->count();
$gift_permision = $total_referrals < (int) $limitValue;
}
if ($gift_permision && $gift_for_inviter > 0) {
// dd($gift_for_inviter > 0, $gift_for_invited > 0);