small rewrite of activity log // log refs
This commit is contained in:
parent
9ad3ed931b
commit
2bc5e91c25
|
@ -190,6 +190,12 @@ class PaymentController extends Controller
|
||||||
$ref_user = User::findOrFail($ref_user->referral_id);
|
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||||
$ref_user->increment('credits', $increment);
|
$ref_user->increment('credits', $increment);
|
||||||
|
|
||||||
|
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||||
|
activity()
|
||||||
|
->performedOn($user)
|
||||||
|
->causedBy($ref_user)
|
||||||
|
->log('gained '. $increment.' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for commission-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -347,6 +353,12 @@ class PaymentController extends Controller
|
||||||
$ref_user = User::findOrFail($ref_user->referral_id);
|
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||||
$ref_user->increment('credits', $increment);
|
$ref_user->increment('credits', $increment);
|
||||||
|
|
||||||
|
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||||
|
activity()
|
||||||
|
->performedOn($user)
|
||||||
|
->causedBy($ref_user)
|
||||||
|
->log('gained '. $increment.' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for commission-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -462,6 +474,12 @@ class PaymentController extends Controller
|
||||||
$ref_user = User::findOrFail($ref_user->referral_id);
|
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||||
$ref_user->increment('credits', $increment);
|
$ref_user->increment('credits', $increment);
|
||||||
|
|
||||||
|
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||||
|
activity()
|
||||||
|
->performedOn($user)
|
||||||
|
->causedBy($ref_user)
|
||||||
|
->log('gained '. $increment.' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for commission-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,12 @@ class RegisterController extends Controller
|
||||||
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->increment('credits', config("SETTINGS::REFERRAL::REWARD"));
|
||||||
$ref_user->notify(new ReferralNotification($ref_user->id, $new_user));
|
$ref_user->notify(new ReferralNotification($ref_user->id, $new_user));
|
||||||
|
|
||||||
|
//LOGS REFERRALS IN THE ACTIVITY LOG
|
||||||
|
activity()
|
||||||
|
->performedOn($user)
|
||||||
|
->causedBy($ref_user)
|
||||||
|
->log('gained '. config("SETTINGS::REFERRAL::REWARD").' '.config("SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME").' for sign-up-referral of '.$user->name.' (ID:'.$user->id.')');
|
||||||
}
|
}
|
||||||
//INSERT INTO USER_REFERRALS TABLE
|
//INSERT INTO USER_REFERRALS TABLE
|
||||||
DB::table('user_referrals')->insert([
|
DB::table('user_referrals')->insert([
|
||||||
|
|
|
@ -77,22 +77,20 @@
|
||||||
@endif</td>
|
@endif</td>
|
||||||
<td>
|
<td>
|
||||||
<span>
|
<span>
|
||||||
@switch($log->description)
|
@if(str_starts_with($log->description,"created"))
|
||||||
@case('created')
|
|
||||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||||
@break
|
@elseif(str_starts_with($log->description,"redeemed"))
|
||||||
@case('redeemed')
|
|
||||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||||
@break
|
@elseif(str_starts_with($log->description,"deleted"))
|
||||||
@case('deleted')
|
|
||||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||||
@break
|
@elseif(str_starts_with($log->description,"gained"))
|
||||||
@case('updated')
|
<small><i class="fas text-success fa-money-bill mr-2"></i></small>
|
||||||
|
@elseif(str_starts_with($log->description,"updated"))
|
||||||
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
||||||
@break
|
@endif
|
||||||
@endswitch
|
|
||||||
{{ucfirst($log->description)}}
|
|
||||||
{{ explode("\\" , $log->subject_type)[2]}}
|
{{ explode("\\" , $log->subject_type)[2]}}
|
||||||
|
{{$log->description}}
|
||||||
|
|
||||||
@php $first=true @endphp
|
@php $first=true @endphp
|
||||||
@foreach(json_decode($log->properties, true) as $properties)
|
@foreach(json_decode($log->properties, true) as $properties)
|
||||||
@if($first)
|
@if($first)
|
||||||
|
|
|
@ -144,22 +144,19 @@
|
||||||
as $log)
|
as $log)
|
||||||
<li class="list-group-item d-flex justify-content-between text-muted">
|
<li class="list-group-item d-flex justify-content-between text-muted">
|
||||||
<span>
|
<span>
|
||||||
@switch($log->description)
|
@if(str_starts_with($log->description,"created"))
|
||||||
@case('created')
|
|
||||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||||
@break
|
@elseif(str_starts_with($log->description,"redeemed"))
|
||||||
@case('redeemed')
|
|
||||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||||
@break
|
@elseif(str_starts_with($log->description,"deleted"))
|
||||||
@case('deleted')
|
|
||||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||||
@break
|
@elseif(str_starts_with($log->description,"gained"))
|
||||||
@case('updated')
|
<small><i class="fas text-success fa-money-bill mr-2"></i></small>
|
||||||
|
@elseif(str_starts_with($log->description,"updated"))
|
||||||
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
||||||
@break
|
@endif
|
||||||
@endswitch
|
|
||||||
{{ ucfirst($log->description) }}
|
|
||||||
{{ explode('\\', $log->subject_type)[2] }}
|
{{ explode('\\', $log->subject_type)[2] }}
|
||||||
|
{{ ucfirst($log->description) }}
|
||||||
</span>
|
</span>
|
||||||
<small>
|
<small>
|
||||||
{{ $log->created_at->diffForHumans() }}
|
{{ $log->created_at->diffForHumans() }}
|
||||||
|
|
Loading…
Reference in a new issue