Skip to content

Commit

Permalink
Merge pull request #27 from SujalRatnaTamrakar/main
Browse files Browse the repository at this point in the history
Fix error when model column is array for old value
  • Loading branch information
199ocero authored May 23, 2024
2 parents d6ef469 + dd5e58c commit 78ffb80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Concerns/HasSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ private function modifiedState(): array
$changes = [];

foreach ($newValues as $key => $newValue) {
$oldValues[$key] = $oldValues[$key] ?? '';
$oldValue = is_array($oldValues[$key]) ? json_encode($oldValues[$key]) : $oldValues[$key] ?? '-';
$newValue = $newValue ?? '';

if (is_array($newValue)) {
$newValue = json_encode($newValue);
}

if (isset($oldValues[$key]) && $oldValues[$key] != $newValue) {
$changes[] = "- {$key} from <strong>".htmlspecialchars($oldValues[$key]).'</strong> to <strong>'.htmlspecialchars($newValue).'</strong>';
$changes[] = "- {$key} from <strong>".htmlspecialchars($oldValue).'</strong> to <strong>'.htmlspecialchars($newValue).'</strong>';
}
}

Expand Down

0 comments on commit 78ffb80

Please sign in to comment.