small rewrite of activity log // log refs
This commit is contained in:
parent
9ad3ed931b
commit
2bc5e91c25
4 changed files with 46 additions and 27 deletions
|
@ -190,6 +190,12 @@ class PaymentController extends Controller
|
|||
$ref_user = User::findOrFail($ref_user->referral_id);
|
||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||
$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);
|
||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||
$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);
|
||||
$increment = number_format($shopProduct->quantity/100*config("SETTINGS::REFERRAL:PERCENTAGE"),0,"","");
|
||||
$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") {
|
||||
$ref_user->increment('credits', config("SETTINGS::REFERRAL::REWARD"));
|
||||
$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
|
||||
DB::table('user_referrals')->insert([
|
||||
|
|
|
@ -77,27 +77,25 @@
|
|||
@endif</td>
|
||||
<td>
|
||||
<span>
|
||||
@switch($log->description)
|
||||
@case('created')
|
||||
@if(str_starts_with($log->description,"created"))
|
||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||
@break
|
||||
@case('redeemed')
|
||||
@elseif(str_starts_with($log->description,"redeemed"))
|
||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||
@break
|
||||
@case('deleted')
|
||||
@elseif(str_starts_with($log->description,"deleted"))
|
||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||
@break
|
||||
@case('updated')
|
||||
@elseif(str_starts_with($log->description,"gained"))
|
||||
<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>
|
||||
@break
|
||||
@endswitch
|
||||
{{ucfirst($log->description)}}
|
||||
@endif
|
||||
{{ explode("\\" , $log->subject_type)[2]}}
|
||||
{{$log->description}}
|
||||
|
||||
@php $first=true @endphp
|
||||
@foreach(json_decode($log->properties, true) as $properties)
|
||||
@if($first)
|
||||
@if(isset($properties['name']))
|
||||
" {{$properties['name']}} "
|
||||
"{{$properties['name']}}"
|
||||
@endif
|
||||
@if(isset($properties['email']))
|
||||
< {{$properties['email']}} >
|
||||
|
|
|
@ -144,22 +144,19 @@
|
|||
as $log)
|
||||
<li class="list-group-item d-flex justify-content-between text-muted">
|
||||
<span>
|
||||
@switch($log->description)
|
||||
@case('created')
|
||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||
@break
|
||||
@case('redeemed')
|
||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||
@break
|
||||
@case('deleted')
|
||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||
@break
|
||||
@case('updated')
|
||||
<small><i class="fas text-info fa-pen mr-2"></i></small>
|
||||
@break
|
||||
@endswitch
|
||||
{{ ucfirst($log->description) }}
|
||||
@if(str_starts_with($log->description,"created"))
|
||||
<small><i class="fas text-success fa-plus mr-2"></i></small>
|
||||
@elseif(str_starts_with($log->description,"redeemed"))
|
||||
<small><i class="fas text-success fa-money-check-alt mr-2"></i></small>
|
||||
@elseif(str_starts_with($log->description,"deleted"))
|
||||
<small><i class="fas text-danger fa-times mr-2"></i></small>
|
||||
@elseif(str_starts_with($log->description,"gained"))
|
||||
<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>
|
||||
@endif
|
||||
{{ explode('\\', $log->subject_type)[2] }}
|
||||
{{ ucfirst($log->description) }}
|
||||
</span>
|
||||
<small>
|
||||
{{ $log->created_at->diffForHumans() }}
|
||||
|
|
Loading…
Reference in a new issue