mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Check for category ID
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
1d45e0df79
commit
75da626c85
|
@ -20,11 +20,14 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
|||
public function prepareForValidation(): void
|
||||
{
|
||||
|
||||
$this->category_type = Category::find($this->category_id)->category_type;
|
||||
if ($this->category_id) {
|
||||
$this->category_type = Category::find($this->category_id)->category_type;
|
||||
|
||||
$this->merge([
|
||||
'category_type' => $this->category_type,
|
||||
]);
|
||||
}
|
||||
|
||||
$this->merge([
|
||||
'category_type' => $this->category_type,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +38,7 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
|||
public function rules(): array
|
||||
{
|
||||
return array_merge(
|
||||
['category_type' => 'required|in:asset'],
|
||||
['category_type' => 'in:asset'],
|
||||
parent::rules(),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue