diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index c838da15e5..ca3e6400f4 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -530,7 +530,6 @@ class AssetsController extends Controller * @author [A. Gianotto] [] * @param \App\Http\Requests\ImageUploadRequest $request * @since [v4.0] - * @return JsonResponse */ public function store(ImageUploadRequest $request) { diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 1ce38bca01..7bce0df242 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -220,8 +220,6 @@ class Asset extends Depreciable } } - - return parent::save($params); } diff --git a/app/Models/CustomFieldset.php b/app/Models/CustomFieldset.php index a2698d818c..a62f96d631 100644 --- a/app/Models/CustomFieldset.php +++ b/app/Models/CustomFieldset.php @@ -92,6 +92,8 @@ class CustomFieldset extends Model array_push($rule, $field->attributes['format']); $rules[$field->db_column_name()] = $rule; + //add not_array to rules for all fields + $rules[$field->db_column_name()][] = 'not_array'; } return $rules; diff --git a/app/Providers/ValidationServiceProvider.php b/app/Providers/ValidationServiceProvider.php index d7a3c03778..70fa64702e 100644 --- a/app/Providers/ValidationServiceProvider.php +++ b/app/Providers/ValidationServiceProvider.php @@ -232,6 +232,10 @@ class ValidationServiceProvider extends ServiceProvider return true; } }); + + Validator::extend('not_array', function ($attribute, $value, $parameters, $validator) { + return !is_array($value); + }); } /** diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index df514da6f9..bb35515fdb 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -95,6 +95,7 @@ return [ 'url' => 'The :attribute format is invalid.', 'unique_undeleted' => 'The :attribute must be unique.', 'non_circular' => 'The :attribute must not create a circular reference.', + 'not_array' => 'The :attribute field cannot be an array.', 'disallow_same_pwd_as_user_fields' => 'Password cannot be the same as the username.', 'letters' => 'Password must contain at least one letter.', 'numbers' => 'Password must contain at least one number.',