pendingDelete === null) { return; } $person = Person::where('uuid', $this->pendingDelete)->first(); if ($person !== null) { if ($person->avatar_path) { Storage::disk('public')->delete($person->avatar_path); } $person->delete(); } $this->pendingDelete = null; } public function render() { $persons = Person::orderBy('name')->get(); return view('livewire.persons.index', [ 'persons' => $persons, 'home' => $persons->where('presence', 'home')->values(), 'awayCount' => $persons->where('presence', '!=', 'home')->count(), ]); } }