fix(perfume): image tidak boleh null sbeagai gantinya jadi array kosong
This commit is contained in:
parent
76b9e99f02
commit
f68875c6ad
@ -38,7 +38,7 @@ class PerfumeForm extends Form
|
||||
|
||||
public array $category_ids = [];
|
||||
|
||||
public ?array $image = null;
|
||||
public array $image = [];
|
||||
|
||||
public array $outlet_ids = [];
|
||||
|
||||
@ -116,9 +116,7 @@ public function store()
|
||||
|
||||
$perfume->outlets()->attach($this->outlet_ids);
|
||||
|
||||
if ($this->image) {
|
||||
$this->image = $this->mapMediaCollection($perfume->getMedia('image'));
|
||||
}
|
||||
$this->uploadMedia($this->image, $perfume, 'image');
|
||||
});
|
||||
}
|
||||
|
||||
@ -135,8 +133,8 @@ public function update()
|
||||
|
||||
$this->perfume->outlets()->sync($this->outlet_ids);
|
||||
|
||||
$this->syncMedia($data['image'] ?? [], $this->perfume, 'image');
|
||||
$this->uploadMedia($data['image'] ?? [], $this->perfume, 'image');
|
||||
$this->syncMedia($data['image'], $this->perfume, 'image');
|
||||
$this->uploadMedia($data['image'], $this->perfume, 'image');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user