parfum/app/Livewire/Studio/Catalog/Bottle/Create.php
Yoga Pangestu 4c43729299 feat(bottle): crud botol
-menambahkan skema model dan migrsai
-menyesuaikan relasi
2025-10-02 09:34:56 +07:00

50 lines
1.0 KiB
PHP

<?php
namespace App\Livewire\Studio\Catalog\Bottle;
use App\Livewire\Forms\BottleForm;
use App\Models\Outlet;
use App\Traits\WithOutletSelector;
use App\Traits\WithUpdatedData;
use Flux\Flux;
use Livewire\Attributes\Title;
use Livewire\Component;
#[Title('Tambah Botol')]
class Create extends Component
{
use WithOutletSelector, WithUpdatedData;
public BottleForm $form;
public array $outlets = [];
public function mount()
{
$this->outlets = Outlet::pluck('name', 'id')->toArray();
}
public function save()
{
$this->form->store();
$this->dispatch('refreshDatatable');
Flux::toast(
heading: 'Berhasil',
text: 'Botol berhasil ditambahkan.',
variant: 'success',
duration: 3000
);
$this->redirectRoute('studio.catalog.bottle.index', navigate: true);
}
public function render()
{
return view('livewire.studio.catalog.bottle.form', [
'pageTitle' => 'Tambah Botol',
]);
}
}