48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Studio\Catalog\Bottle;
|
|
|
|
use App\Livewire\Forms\Studio\Catalog\BottleForm;
|
|
use App\Models\Outlet;
|
|
use App\Traits\WithAuthorization;
|
|
use App\Traits\WithOutletSelector;
|
|
use App\Traits\WithToast;
|
|
use App\Traits\WithUpdatedData;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
|
|
#[Title('Tambah Botol')]
|
|
class Create extends Component
|
|
{
|
|
use WithAuthorization, WithOutletSelector, WithToast, WithUpdatedData;
|
|
|
|
public BottleForm $form;
|
|
|
|
public array $outlets = [];
|
|
|
|
public function mount()
|
|
{
|
|
$this->outlets = Outlet::pluck('name', 'id')->toArray();
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$this->canOrAbort('create bottle');
|
|
|
|
$this->form->store();
|
|
|
|
$this->dispatch('refreshDatatable');
|
|
|
|
$this->toast('Botol berhasil ditambahkan.');
|
|
|
|
$this->redirectRoute('studio.catalog.bottle.index');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.studio.catalog.bottle.form', [
|
|
'pageTitle' => 'Tambah Botol',
|
|
]);
|
|
}
|
|
}
|