sortBy === $column) { $this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc'; } else { $this->sortBy = $column; $this->sortDirection = 'asc'; } } #[On('contact-created')] #[On('contact-updated')] public function refresh(): void {} #[Computed] public function contacts() { return Contact::orderBy($this->sortBy, $this->sortDirection)->paginate(10); } }; ?>
First Name Last Name Email Phone Created @foreach($this->contacts as $contact) {{ $contact->first_name }} {{ $contact->last_name }} {{ $contact->email }} {{ $contact->phone }} {{ $contact->created_at->local()->format('m/d/Y | g:i A') }} Edit @endforeach