mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 10:02:33 +03:00
Improve the Model "optional" method functionality for empty values
This commit is contained in:
parent
faa66723f9
commit
99cf4c8da2
1 changed files with 2 additions and 2 deletions
|
@ -189,12 +189,12 @@ class EA_Model extends CI_Model
|
||||||
{
|
{
|
||||||
if (is_assoc($record)) {
|
if (is_assoc($record)) {
|
||||||
foreach ($fields as $field => $default) {
|
foreach ($fields as $field => $default) {
|
||||||
$record[$field] = $record[$field] ?? $default;
|
$record[$field] = $record[$field] ?? null ?: $default;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($record as &$record_item) {
|
foreach ($record as &$record_item) {
|
||||||
foreach ($fields as $field => $default) {
|
foreach ($fields as $field => $default) {
|
||||||
$record_item[$field] = $record_item[$field] ?? $default;
|
$record_item[$field] = $record_item[$field] ?? null ?: $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue