fix: update stock validation to be conditionally required based on request method

This commit is contained in:
Yoga Pangestu 2026-04-21 19:22:03 +07:00
parent 486d626ca2
commit 959c01b6bc

View File

@ -40,7 +40,7 @@ public function rules(): array
'images.*' => ['image', 'max:5120'],
'delete_image_ids' => ['nullable', 'array'],
'delete_image_ids.*' => ['integer'],
'stock' => ['required', 'integer', 'min:0'],
'stock' => [Rule::requiredIf($this->isMethod('post')), 'integer', 'min:0'],
];
}
}