Add "both" mode to referrals
This commit is contained in:
parent
42ff82c310
commit
d2608c995c
3 changed files with 6 additions and 4 deletions
|
@ -185,7 +185,7 @@ class PaymentController extends Controller
|
|||
if ($user->role == 'member') {
|
||||
$user->update(['role' => 'client']);
|
||||
|
||||
if(config("SETTINGS::REFERRAL:MODE") == "commission" && $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" && $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" && $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,"","");
|
||||
|
|
|
@ -139,7 +139,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")) {
|
||||
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));
|
||||
}
|
||||
|
|
|
@ -213,6 +213,8 @@
|
|||
@endif>{{ __("Commission") }}</option>
|
||||
<option value="sign-up" @if (config('SETTINGS::REFERRAL:MODE') == "sign-up") selected
|
||||
@endif>{{ __("Sign-Up") }}</option>
|
||||
<option value="both" @if (config('SETTINGS::REFERRAL:MODE') == "both") selected
|
||||
@endif>{{ __("Both") }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group mb-3">
|
||||
|
|
Loading…
Reference in a new issue