diff --git a/app/Http/Controllers/Customer/CustomerController.php b/app/Http/Controllers/Customer/CustomerController.php index fc23734..3c630f1 100644 --- a/app/Http/Controllers/Customer/CustomerController.php +++ b/app/Http/Controllers/Customer/CustomerController.php @@ -197,7 +197,10 @@ class CustomerController extends Controller $companyName = $this->Config('name_fa'); $companyurl = $this->Config('app_url'); $referrer = $customer->referral; - if (Customer::where('referral_to_id', $referrer->referral_id)->get()->count() <= $referrer->add_user_limit && $gift_for_inviter > 0) { + $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->active ? $total_referrals < $referral_limit->value ? true : false : true ; + if ($gift_permision && $gift_for_inviter > 0) { // dd($gift_for_inviter > 0, $gift_for_invited > 0); $Withdraw = Withdraw::create([