Primo commit

This commit is contained in:
Francesco Picone
2026-04-05 19:26:04 +02:00
commit 701f479b7f
135 changed files with 21445 additions and 0 deletions

57
app/Livewire/AuditLog.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
namespace App\Livewire;
use Livewire\Component;
use Livewire\WithPagination;
use Spatie\Activitylog\Models\Activity;
class AuditLog extends Component
{
use WithPagination;
public string $search = '';
public string $filterEvent = '';
public string $filterCauser = '';
protected $queryString = [
'search' => ['except' => ''],
'filterEvent' => ['except' => ''],
'filterCauser' => ['except' => ''],
];
public function updatingSearch()
{
$this->resetPage();
}
public function render()
{
$query = Activity::with('causer')->latest();
if ($this->search) {
$query->where(function ($q) {
$q->where('description', 'like', "%{$this->search}%")
->orWhere('subject_type', 'like', "%{$this->search}%")
->orWhere('properties', 'like', "%{$this->search}%");
});
}
if ($this->filterEvent) {
$query->where('description', $this->filterEvent);
}
if ($this->filterCauser) {
$query->where('causer_id', $this->filterCauser);
}
$events = Activity::select('description')->distinct()->pluck('description');
$users = \App\Models\User::orderBy('name')->get();
return view('livewire.audit-log', [
'activities' => $query->paginate(30),
'events' => $events,
'users' => $users,
]);
}
}