Change setting table ID to string, handle the converison of . to _

This commit is contained in:
Nabeel Shahzad
2017-12-31 11:09:56 -06:00
parent 528a7c7440
commit 948338d2b6
5 changed files with 53 additions and 30 deletions

View File

@@ -28,8 +28,8 @@ class SettingRepository extends BaseRepository implements CacheableInterface
*/
public function retrieve($key)
{
$key = strtolower($key);
$setting = $this->findWhere(['key' => $key], ['type', 'value'])->first();
$key = str_replace('.', '_', strtolower($key));
$setting = $this->findWhere(['id' => $key], ['type', 'value'])->first();
if(!$setting) {
return null;
@@ -46,8 +46,12 @@ class SettingRepository extends BaseRepository implements CacheableInterface
break;
case 'int':
case 'integer':
case 'number':
return (int) $setting->value;
break;
case 'float':
return (float) $setting->value;
break;
default:
return $setting->value;
}