flash('message', 'Edit action for user ID: ' . $rowId); } public function deleteRow($rowId) { // Logic for deleting a row (e.g., delete from database) session()->flash('message', 'Delete action for user ID: ' . $rowId); } public function viewRow($rowId) { // Logic for viewing a row (e.g., redirect to the view page or open a modal) session()->flash('message', 'View action for user ID: ' . $rowId); } public function selectAllRows() { // Convert rows to a collection if it is an array, then pluck the 'id' if ($this->selectAll) { $this->selected = collect($this->rows)->pluck('id')->toArray(); } else { $this->selected = []; } } public function selectRow($rowId) { if (in_array($rowId, $this->selected)) { $this->selected = array_diff($this->selected, [$rowId]); } else { $this->selected[] = $rowId; } } public function render() { return view('livewire.components.table'); } }