mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
More tweaks to the form request
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
b3cc7b1578
commit
0d6fd2643d
|
@ -21,11 +21,11 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
|||
{
|
||||
|
||||
if ($this->category_id) {
|
||||
$this->category_type = Category::find($this->category_id)->category_type;
|
||||
|
||||
$this->merge([
|
||||
'category_type' => $this->category_type,
|
||||
]);
|
||||
if ($category = Category::find($this->category_id)) {
|
||||
$this->merge([
|
||||
'category_type' => $category->category_type ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -48,4 +48,9 @@ class StoreAssetModelRequest extends ImageUploadRequest
|
|||
$messages = ['category_type.in' => trans('admin/models/message.invalid_category_type')];
|
||||
return $messages;
|
||||
}
|
||||
|
||||
public function response(array $errors)
|
||||
{
|
||||
return $this->redirector->back()->withInput()->withErrors($errors, $this->errorBag);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue