isDir() || strtolower($fileInfo->getFilename()) == 'base') { continue; } $themeName = strtolower($fileInfo->getFilename()); $themeDisplayName = $themeName; $themeInfoFilename = sprintf('%s/theme.json', $fileInfo->getPathname()); if (file_exists($themeInfoFilename)) { $themeInfo = json_decode(file_get_contents($themeInfoFilename)); if ($themeInfo !== false && isset($themeInfo->name)) { $themeDisplayName = $themeInfo->name; } } $results[$themeName] = $themeDisplayName; } return $results; } public function defaults() { return array( 'allow_self_registration' => true, 'app_name' => trans('global.app_name'), 'date_format' => $this->allowedDateFormats()[0], 'require_email_verification' => true ); } public function get($key, $defaultIfUnset = true) { $config = Configuration::where('key', $key)->first(); return (is_null($config) ? $this->defaults()[$key] : $config->value); } public function getAll() { $results = array(); foreach (Configuration::all() as $config) { $results[$config->key] = $config->value; } return $results; } public function getOrCreateModel($key) { $config = Configuration::where('key', $key)->first(); if (is_null($config) || $config === false) { $config = new Configuration(); $config->key = $key; $config->value = ''; $config->save(); } return $config; } }