Skip to content

Commit

Permalink
Add condition to only run trough custom fields if a custom fieldset e…
Browse files Browse the repository at this point in the history
…xist
  • Loading branch information
inietov committed Oct 31, 2023
1 parent 8e20071 commit 9f9f8c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/Models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ public function save(array $params = [])

$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);
}
}
}
}
Expand Down

0 comments on commit 9f9f8c1

Please sign in to comment.