96 lines
3.9 KiB
PHP
96 lines
3.9 KiB
PHP
<?php
|
|
|
|
use App\Models\Log;
|
|
use App\Models\Quote;
|
|
use App\Models\RequestedQuote;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Volt\Component;
|
|
use Livewire\WithPagination;
|
|
use Spatie\Activitylog\Models\Activity;
|
|
|
|
new #[Layout('layouts.app')] class extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public function with(): array
|
|
{
|
|
$logs = Activity::with(['causer', 'subject'])
|
|
->orderByDesc('id')
|
|
->paginate(15);
|
|
|
|
return [
|
|
'logs' => $logs,
|
|
];
|
|
}
|
|
}; ?>
|
|
|
|
<div class="px-4 sm:px-6 lg:px-8">
|
|
<div class="-mx-4 mt-10 ring-1 ring-gray-300 sm:mx-0 sm:rounded-lg bg-nexi-primary dark:bg-zinc-800 transition-colors duration-300">
|
|
<table class="min-w-full divide-y divide-gray-300">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col"
|
|
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-nexi-black dark:text-gray-200 sm:pl-6">
|
|
User
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
Type
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
Entity ID
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
Event
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
Logs
|
|
</th>
|
|
<th scope="col"
|
|
class="px-3 py-3.5 text-left text-sm font-semibold text-nexi-black dark:text-gray-200">
|
|
IP
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($logs as $log)
|
|
<tr>
|
|
<td class="relative py-4 px-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
|
|
{{ $log?->causer?->full_name ?? 'Anonymous' }}
|
|
</td>
|
|
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
|
|
{{ str_replace('App\Models\\', '', $log->subject_type) }}
|
|
</td>
|
|
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
|
|
{{ $log->subject_id }}
|
|
</td>
|
|
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
|
|
{{ \Illuminate\Support\Str::headline($log->event) }}
|
|
</td>
|
|
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
|
|
@switch($log->subject_type)
|
|
@case(Quote::class)
|
|
@case(RequestedQuote::class)
|
|
{{ $log?->subject?->quote }}
|
|
@break
|
|
@default
|
|
{{ $log->description }}
|
|
@endswitch
|
|
</td>
|
|
<td class="relative py-4 pr-3 text-sm sm:pl-6 border-t text-nexi-black dark:text-gray-200">
|
|
{{ $log->getExtraProperty('ip') }}
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="mt-4">
|
|
{{ $logs->links('components.paginator') }}
|
|
</div>
|
|
</div>
|
|
|