reafctor(perfume): model brand diubah menjadi brand_id

This commit is contained in:
Yoga Pangestu 2025-10-03 07:59:33 +07:00
parent eff1e842e3
commit 99d5858641
2 changed files with 6 additions and 6 deletions

View File

@ -20,7 +20,7 @@ class PerfumeForm extends Form
public string $sku = '';
public ?string $brand = null;
public ?string $brand_id = null;
public string $cost_price = '';
@ -52,7 +52,7 @@ public function rules(): array
'max:20',
Rule::unique('perfumes', 'sku')->ignore($this->perfume),
],
'brand' => ['nullable', Rule::exists('brands', 'id')],
'brand_id' => ['nullable', Rule::exists('brands', 'id')],
'cost_price' => ['required', new UnsignedInteger],
'sale_price' => ['required', new UnsignedInteger],
'base_notes' => ['nullable', 'string', 'max:255'],
@ -72,7 +72,7 @@ public function validationAttributes(): array
{
return [
'name' => 'nama',
'brand' => 'merek',
'brand_id' => 'merek',
'cost_price' => 'harga beli',
'sale_price' => 'harga jual',
'description' => 'deskripsi',
@ -90,7 +90,7 @@ public function setPerfume(Perfume $perfume)
$this->name = $perfume->name;
$this->sku = $perfume->sku;
$this->brand = $perfume->brand_id;
$this->brand_id = $perfume->brand_id;
$this->cost_price = $perfume->cost_price;
$this->sale_price = $perfume->sale_price;
$this->base_notes = $perfume->base_notes;
@ -150,7 +150,7 @@ private function prepareSavedData()
'top_notes' => $this->top_notes,
'description' => $this->description,
'concentration' => $this->concentration,
'brand_id' => $this->brand,
'brand_id' => $this->brand_id,
'category_ids' => $this->category_ids,
'outlet_ids' => $this->outlet_ids,
'image' => $this->image,

View File

@ -35,7 +35,7 @@
<div class="lg:col-span-2">
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<flux:select variant="listbox" searchable placeholder="Pilih Merek"
label="Merek" wire:model.live.debounce.500ms="form.brand">
label="Merek" wire:model.live.debounce.500ms="form.brand_id">
@foreach ($brands as $key => $value)
<flux:select.option value="{{ $key }}">{{ $value }}
</flux:select.option>