reafctor(perfume): model brand diubah menjadi brand_id
This commit is contained in:
parent
eff1e842e3
commit
99d5858641
@ -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,
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user