diff --git a/app/Http/Requests/AssetRequest.php b/app/Http/Requests/AssetRequest.php index 72c3a89ccb..082320e6ba 100644 --- a/app/Http/Requests/AssetRequest.php +++ b/app/Http/Requests/AssetRequest.php @@ -28,6 +28,7 @@ class AssetRequest extends Request public function rules() { $rules = [ + 'asset_tag' => 'required|min:1|max:255|unique_undeleted', 'name' => 'max:255|nullable', 'model_id' => 'required|integer|exists:models,id', 'status_id' => 'required|integer|exists:status_labels,id', @@ -45,9 +46,7 @@ class AssetRequest extends Request ]; $settings = \App\Models\Setting::getSettings(); - - $rules['asset_tag'] = ($settings->auto_increment_assets == '1') ? 'max:255' : 'required'; - + if ($this->request->get('model_id') != '') { $model = AssetModel::find($this->request->get('model_id'));