['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(); $activities = $query->paginate(30); // Il log conserva solo l'id del proclamatore: il nome si legge adesso, // così chi è stato anonimizzato compare come tale anche nello storico. $idProclamatori = $activities->getCollection() ->map(fn ($a) => data_get($a->properties, 'proclamatore_id')) ->filter() ->unique(); $nomiProclamatori = \App\Models\Proclamatore::withTrashed() ->whereIn('id', $idProclamatori) ->get() ->mapWithKeys(fn ($p) => [$p->id => $p->nome_completo]); return view('livewire.audit-log', [ 'activities' => $activities, 'nomiProclamatori' => $nomiProclamatori, 'events' => $events, 'users' => $users, ]); } }