diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php index 67f9fbab..8d3a0d23 100644 --- a/app/Http/Controllers/Admin/PaymentController.php +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -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.')'); } } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index ea164fb8..5a805987 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -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([ diff --git a/resources/views/admin/activitylogs/index.blade.php b/resources/views/admin/activitylogs/index.blade.php index 2382a8c3..e0eedc6f 100644 --- a/resources/views/admin/activitylogs/index.blade.php +++ b/resources/views/admin/activitylogs/index.blade.php @@ -77,27 +77,25 @@ @endif - @switch($log->description) - @case('created') + @if(str_starts_with($log->description,"created")) - @break - @case('redeemed') + @elseif(str_starts_with($log->description,"redeemed")) - @break - @case('deleted') + @elseif(str_starts_with($log->description,"deleted")) - @break - @case('updated') + @elseif(str_starts_with($log->description,"gained")) + + @elseif(str_starts_with($log->description,"updated")) - @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']}} > diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index a8d58c88..407b127d 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -144,22 +144,19 @@ as $log)
  • - @switch($log->description) - @case('created') - - @break - @case('redeemed') - - @break - @case('deleted') - - @break - @case('updated') - - @break - @endswitch - {{ ucfirst($log->description) }} + @if(str_starts_with($log->description,"created")) + + @elseif(str_starts_with($log->description,"redeemed")) + + @elseif(str_starts_with($log->description,"deleted")) + + @elseif(str_starts_with($log->description,"gained")) + + @elseif(str_starts_with($log->description,"updated")) + + @endif {{ explode('\\', $log->subject_type)[2] }} + {{ ucfirst($log->description) }} {{ $log->created_at->diffForHumans() }}