Merge pull request #13758 from inietov/fixes/array_to_string_conversion_rb17355

Fixed ErrorException: Array to String Conversion rb17355
This commit is contained in:
snipe 2023-10-18 19:09:13 +01:00 committed by GitHub
commit 38066bf162
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 3 deletions

View file

@ -530,7 +530,6 @@ class AssetsController extends Controller
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param \App\Http\Requests\ImageUploadRequest $request
* @since [v4.0]
* @return JsonResponse
*/
public function store(ImageUploadRequest $request)
{

View file

@ -220,8 +220,6 @@ class Asset extends Depreciable
}
}
return parent::save($params);
}

View file

@ -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;

View file

@ -232,6 +232,10 @@ class ValidationServiceProvider extends ServiceProvider
return true;
}
});
Validator::extend('not_array', function ($attribute, $value, $parameters, $validator) {
return !is_array($value);
});
}
/**

View file

@ -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.',