safer casting for boolean values
This commit is contained in:
parent
7c70bb0971
commit
36c904d98d
@ -42,7 +42,14 @@ class SettingRepository extends BaseRepository implements CacheableInterface
|
||||
switch($setting->type) {
|
||||
case 'bool':
|
||||
case 'boolean':
|
||||
return (bool) $setting->value;
|
||||
$value = $setting->value;
|
||||
if($value === 'true' || $value === '1') {
|
||||
$value = true;
|
||||
} elseif($value === 'false' || $value === '0') {
|
||||
$value = false;
|
||||
}
|
||||
|
||||
return (bool) $value;
|
||||
break;
|
||||
case 'date':
|
||||
return Carbon::parse($setting->value);
|
||||
|
Loading…
Reference in New Issue
Block a user