'$refresh', 'closeModal' => '$refresh', ]; public function query(): Builder { return HostGroup::query()->with(['hosts:id']); } public function headers(): array { return [ 'name' => 'name', 'hosts_count' => 'hosts_count', ]; } public function row($row){ $row['hosts_count'] = $row->hosts->count(); return $row; } public function remove($hostgroup_id){ HostGroup::find($hostgroup_id)->delete(); } public function actions($item) { return [ [ 'type' => "livewire", 'action' => "edit", 'text' => "edit", 'parameters' => $item['id'] ], [ 'type' => "livewire", 'action' => "remove", 'text' => "remove", 'parameters' => $item['id'] ] ]; } public function edit($host_id) { $this->dispatch('openModal', 'host.form', __('boilerplate::host.edit'), ['model' => $host_id]); } }