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,6 +20,7 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
||||||
public function prepareForValidation(): void
|
public function prepareForValidation(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ($this->category_id) {
|
||||||
$this->category_type = Category::find($this->category_id)->category_type;
|
$this->category_type = Category::find($this->category_id)->category_type;
|
||||||
|
|
||||||
$this->merge([
|
$this->merge([
|
||||||
|
@ -27,6 +28,8 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
|
@ -35,7 +38,7 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return array_merge(
|
return array_merge(
|
||||||
['category_type' => 'required|in:asset'],
|
['category_type' => 'in:asset'],
|
||||||
parent::rules(),
|
parent::rules(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue