parfum/app/Livewire/Studio/Catalog/Bottle/Edit.php
Yoga Pangestu 81a9753620 feat(perfume. bottle): implementasi testing
- kasih return type
- ubah array to collection di audit
- mengubah waktu refresh tabel menjadi 30 detik
2025-12-11 11:15:59 +07:00

52 lines
1.1 KiB
PHP

<?php
namespace App\Livewire\Studio\Catalog\Bottle;
use App\Livewire\Forms\Studio\Catalog\BottleForm;
use App\Models\Bottle;
use App\Models\Outlet;
use App\Traits\WithAuthorization;
use App\Traits\WithOutletSelector;
use App\Traits\WithToast;
use App\Traits\WithUpdatedData;
use Illuminate\Contracts\View\View;
use Livewire\Attributes\Title;
use Livewire\Component;
#[Title('Ubah Botol')]
class Edit extends Component
{
use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
public BottleForm $form;
public array $outlets = [];
public function mount(Bottle $bottle): void
{
$this->form->setBottle($bottle);
$this->outlets = Outlet::pluck('name', 'id')->toArray();
}
public function save(): void
{
$this->canOrAbort('update bottle');
$this->form->update();
$this->dispatch('refreshDatatable');
$this->toast('Botol berhasil diperbarui.');
$this->redirectRoute('studio.catalog.bottle.index');
}
public function render(): View
{
return view('livewire.studio.catalog.bottle.form', [
'pageTitle' => 'Ubah Botol',
]);
}
}