handled refer_id for jbit
This commit is contained in:
@@ -197,10 +197,15 @@ class CustomerController extends Controller
|
||||
$companyName = $this->Config('name_fa');
|
||||
$companyurl = $this->Config('app_url');
|
||||
$referrer = $customer->referral;
|
||||
$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 ;
|
||||
if ($gift_permision && $gift_for_inviter > 0) {
|
||||
$gift_permision = true;
|
||||
if ($referrer) {
|
||||
$total_referrals = Customer::where('referral_to_id', $referrer->referral_id)->where('is_legal', '!=', 0)->count();
|
||||
$referral_limit = Setting::where('key', 'referral_limit')->first();
|
||||
$gift_permision = $referral_limit && $referral_limit->is_active
|
||||
? $total_referrals < $referral_limit->value
|
||||
: true;
|
||||
}
|
||||
if ($referrer && $gift_permision && $gift_for_inviter > 0) {
|
||||
// dd($gift_for_inviter > 0, $gift_for_invited > 0);
|
||||
|
||||
$Withdraw = Withdraw::create([
|
||||
@@ -273,7 +278,7 @@ class CustomerController extends Controller
|
||||
$transaction = Transaction::where('customer_id', $customer->id)->latest()->first();
|
||||
TransactionsAdmin::create([
|
||||
'customer_id' => $customer->id,
|
||||
'customer_to_id' => $customer->referal->id,
|
||||
'customer_to_id' => $customer->id,
|
||||
'user_id' => $customer->id,
|
||||
'wallet' => null, // یا مقدار مناسب دیگری
|
||||
'transaction_id' => $transaction->id,
|
||||
|
||||
Reference in New Issue
Block a user