mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-05 19:07:30 -08:00
added a way to manipulate validator attribute names
This commit is contained in:
parent
cd3059f790
commit
4f9f035c69
|
@ -483,7 +483,12 @@ class AssetModelsController extends Controller
|
|||
$rules[$field] = $validation;
|
||||
}
|
||||
|
||||
$validator = Validator::make($data, $rules);
|
||||
$attributes = [];
|
||||
foreach ($model->fieldset->fields as $field) {
|
||||
$attributes[$field->db_column] = trim(preg_replace('/_+|snipeit|\d+/', ' ', $field->db_column));
|
||||
}
|
||||
|
||||
$validator = Validator::make($data, $rules)->setAttributeNames($attributes);
|
||||
|
||||
if($validator->fails()){
|
||||
$this->validatorErrors = $validator->errors();
|
||||
|
|
|
@ -127,7 +127,6 @@
|
|||
<?php
|
||||
$errormessage = $errors->first($field->db_column_name());
|
||||
if ($errormessage) {
|
||||
$errormessage = preg_replace('/snipeit|\d+/', '', $errormessage);
|
||||
print('<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> '.$errormessage.'</span>');
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue