canOrAbort('create brand'); $this->form->store(); $this->dispatch('refreshDatatable'); $this->toast('Merek berhasil ditambahkan.'); Flux::modals()->close(); } public function update(): void { $this->canOrAbort('update brand'); $this->form->update(); $this->dispatch('refreshDatatable'); $this->toast('Merek berhasil diperbarui.'); Flux::modals()->close(); } public function delete(BrandModel $brand): void { $this->canOrAbort('delete brand'); $this->form->brand = $brand; $this->form->delete(); $this->dispatch('refreshDatatable'); $this->toast('Merek berhasil dihapus.'); Flux::modals()->close(); } #[On('fn:sortOrder')] public function sortOrder(BrandModel $brand, string $direction): void { $this->canOrAbort('update brand'); $this->form->brand = $brand; $this->form->sortOrder($direction); $this->dispatch('refreshDatatable'); } #[On('modal:open')] public function openModal(string $method, string $modalTitle, ?string $id = null): void { $this->resetValidation(); $this->resetErrorBag(); $this->method = $method; $this->modalTitle = $modalTitle; $id && $this->form->setBrand(BrandModel::byHashOrFail($id)); } public function render(): View { return view('livewire.studio.catalog.brands', [ 'pageTitle' => 'Merek', ]); } }