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