Merge pull request #12976 from inietov/fixes/validate_soft-deleted_models_in_asset_model
Refactor of #12955
This commit is contained in:
commit
6486ea4fb7
2 changed files with 1 additions and 4 deletions
|
@ -573,9 +573,6 @@ class AssetsController extends Controller
|
||||||
// Update custom fields in the database.
|
// Update custom fields in the database.
|
||||||
// Validation for these fields is handled through the AssetRequest form request
|
// Validation for these fields is handled through the AssetRequest form request
|
||||||
$model = AssetModel::find($request->get('model_id'));
|
$model = AssetModel::find($request->get('model_id'));
|
||||||
if (!$model) {
|
|
||||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($model) && ($model->fieldset)) {
|
if (($model) && ($model->fieldset)) {
|
||||||
foreach ($model->fieldset->fields as $field) {
|
foreach ($model->fieldset->fields as $field) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ class Asset extends Depreciable
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'name' => 'max:255|nullable',
|
'name' => 'max:255|nullable',
|
||||||
'model_id' => 'required|integer|exists:models,id',
|
'model_id' => 'required|integer|exists:models,id,deleted_at,NULL',
|
||||||
'status_id' => 'required|integer|exists:status_labels,id',
|
'status_id' => 'required|integer|exists:status_labels,id',
|
||||||
'company_id' => 'integer|nullable',
|
'company_id' => 'integer|nullable',
|
||||||
'warranty_months' => 'numeric|nullable|digits_between:0,240',
|
'warranty_months' => 'numeric|nullable|digits_between:0,240',
|
||||||
|
|
Loading…
Add table
Reference in a new issue