fixed the worst error ive ever experienced

This commit is contained in:
1day2die 2022-06-07 21:58:04 +02:00
parent f03869efb0
commit ad8c8b5ebe
3 changed files with 6 additions and 5 deletions

View file

@ -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,"","");

View file

@ -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));
}

View file

@ -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));
}