Add condition to only run trough custom fields if a custom fieldset exist

This commit is contained in:
Ivan Nieto Vivanco 2023-10-31 10:00:36 -06:00
parent 8e20071254
commit 9f9f8c173b

View file

@ -212,9 +212,11 @@ class Asset extends Depreciable
$this->rules += $model->fieldset->validation_rules();
foreach ($this->model->fieldset->fields as $field){
if($field->format == 'BOOLEAN'){
$this->{$field->db_column} = filter_var($this->{$field->db_column}, FILTER_VALIDATE_BOOLEAN);
if ($this->model->fieldset){
foreach ($this->model->fieldset->fields as $field){
if($field->format == 'BOOLEAN'){
$this->{$field->db_column} = filter_var($this->{$field->db_column}, FILTER_VALIDATE_BOOLEAN);
}
}
}
}