outlets = auth()->user()->outlets->pluck('name', 'id')->toArray(); $this->perfumes = Perfume::orderBy('name')->pluck('name', 'id')->toArray(); $this->bottles = Bottle::orderBy('size')->pluck('name', 'id')->toArray(); $this->products = Product::orderBy('name')->pluck('name', 'id')->toArray(); $this->purchaseItems = $this->loadPurchaseItems(); $this->form->total = $this->getTotal(); } public function save(): void { $this->canOrAbort('create purchase'); if ($this->purchaseItems->isEmpty()) { $this->toast('Keranjang tidak boleh kosong.', 'Gagal', 'danger'); return; } $this->form->store(); $this->dispatch('refreshDatatable'); $this->toast('Belanja berhasil ditambahkan.'); $this->redirectRoute('studio.manage.purchase.index'); } public function render(): View { return view('livewire.studio.manage.purchase.form', [ 'pageTitle' => 'Tambah Belanja', ]); } }