outlets = Outlet::pluck('name', 'id')->toArray(); $this->userHasMultipleOutlets = auth()->user()->outlets()->count() > 1; } public function create(): void { $this->canOrAbort('create expense'); $this->form->store(); $this->dispatch('refreshDatatable'); $this->toast('Pengeluaran berhasil ditambahkan.'); Flux::modals()->close(); } public function update(): void { $this->canOrAbort('update expense'); $this->form->update(); $this->dispatch('refreshDatatable'); $this->toast('Pengeluaran berhasil diperbarui.'); Flux::modals()->close(); } public function delete(ExpenseModel $expense): void { $this->canOrAbort('delete expense'); $expense->delete(); $this->dispatch('refreshDatatable'); $this->toast('Pengeluaran berhasil dihapus.'); Flux::modals()->close(); } #[On('modal:open')] public function openModal(string $method, string $modalTitle, ?string $id = null): void { $this->resetValidation(); $this->resetErrorBag(); $this->method = $method; $this->modalTitle = $modalTitle; if ($id) { $this->form->setExpense(ExpenseModel::byHashOrFail($id)); } } public function render(): View { return view('livewire.studio.finance.expenses', [ 'pageTitle' => 'Pengeluaran', ]); } }