-menambahkan enum untuk tipe diskon persentase atau fixed -membuat tabel, form, migrasi, model dll sesuai dengan kebutuhan fitur
47 lines
962 B
PHP
47 lines
962 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Studio\Loyalty\Voucher;
|
|
|
|
use App\Livewire\Forms\VoucherForm;
|
|
use App\Models\Voucher;
|
|
use App\Traits\WithUpdatedData;
|
|
use Flux\Flux;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Component;
|
|
|
|
#[Title('Ubah Voucher')]
|
|
class Edit extends Component
|
|
{
|
|
use WithUpdatedData;
|
|
|
|
public VoucherForm $form;
|
|
|
|
public function mount(Voucher $voucher)
|
|
{
|
|
$this->form->setVoucher($voucher);
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
$this->form->update();
|
|
|
|
$this->dispatch('refreshDatatable');
|
|
|
|
Flux::toast(
|
|
heading: 'Berhasil',
|
|
text: 'Voucher berhasil diperbarui.',
|
|
variant: 'success',
|
|
duration: 3000
|
|
);
|
|
|
|
$this->redirectRoute('studio.loyalty.voucher.index', navigate: true);
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.studio.loyalty.voucher.form', [
|
|
'pageTitle' => 'Ubah Voucher',
|
|
]);
|
|
}
|
|
}
|