From ad8c8b5ebe8135d972feec754a7c294edeef9766 Mon Sep 17 00:00:00 2001 From: 1day2die Date: Tue, 7 Jun 2022 21:58:04 +0200 Subject: [PATCH] fixed the worst error ive ever experienced --- app/Http/Controllers/Admin/PaymentController.php | 6 +++--- app/Http/Controllers/Api/UserController.php | 2 +- app/Http/Controllers/Auth/RegisterController.php | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index 8f4f4b67..67f9fbab 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -185,7 +185,7 @@ class PaymentController extends Controller if ($user->role == 'member') { $user->update(['role' => 'client']); - if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE" == "both")) && $shopProduct->type=="Credits"){ + if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE") == "both") && $shopProduct->type=="Credits"){ if($ref_user = DB::table("user_referrals")->where('registered_user_id', '=', $user->id)->first()){ $ref_user = User::findOrFail($ref_user->referral_id); $increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"",""); @@ -342,7 +342,7 @@ class PaymentController extends Controller if ($user->role == 'member') { $user->update(['role' => 'client']); - if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE" == "both")) && $shopProduct->type=="Credits"){ + if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE") == "both") && $shopProduct->type=="Credits"){ if($ref_user = DB::table("user_referrals")->where('registered_user_id', '=', $user->id)->first()){ $ref_user = User::findOrFail($ref_user->referral_id); $increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"",""); @@ -457,7 +457,7 @@ class PaymentController extends Controller if ($user->role == 'member') { $user->update(['role' => 'client']); - if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE" == "both"))&& $shopProduct->type=="Credits"){ + if((config("SETTINGS::REFERRAL:MODE") == "commission" || config("SETTINGS::REFERRAL:MODE") == "both")&& $shopProduct->type=="Credits"){ if($ref_user = DB::table("user_referrals")->where('registered_user_id', '=', $user->id)->first()){ $ref_user = User::findOrFail($ref_user->referral_id); $increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"",""); diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index a9f8f1bb..a25b9873 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -288,7 +288,7 @@ class UserController extends Controller $ref_code = $request->input("referral_code"); $new_user = $user->id; if($ref_user = User::query()->where('referral_code', '=', $ref_code)->first()) { - if(config("SETTINGS::REFERRAL:MODE" == "sign-up") || config("SETTINGS::REFERRAL:MODE" == "both")) { + if(config("SETTINGS::REFERRAL:MODE") == "register" || config("SETTINGS::REFERRAL:MODE") == "both") { $ref_user->increment('credits', config("SETTINGS::REFERRAL::REWARD")); $ref_user->notify(new ReferralNotification($ref_user->id, $new_user)); } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index f96a8cc8..ea164fb8 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -14,6 +14,7 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Str; use Illuminate\Validation\ValidationException; @@ -139,7 +140,7 @@ class RegisterController extends Controller $ref_code = $data['referral_code']; $new_user = $user->id; if($ref_user = User::query()->where('referral_code', '=', $ref_code)->first()) { - if(config("SETTINGS::REFERRAL:MODE" == "sign-up") || config("SETTINGS::REFERRAL:MODE" == "both")) { + if(config("SETTINGS::REFERRAL:MODE") == "sign-up" || config("SETTINGS::REFERRAL:MODE") == "both") { $ref_user->increment('credits', config("SETTINGS::REFERRAL::REWARD")); $ref_user->notify(new ReferralNotification($ref_user->id, $new_user)); }