Get default value on config repository

This commit is contained in:
Joseph Cohen 2015-05-20 12:56:59 -05:00
parent 33f6bf167c
commit 10bcbc6169
3 changed files with 7 additions and 4 deletions

View File

@ -25,8 +25,8 @@ class ThemeComposer
*/
public function compose(View $view)
{
$view->with('themeBackgroundColor', Setting::get('style_background_color') ?: null);
$view->with('themeTextColor', Setting::get('style_text_color') ?: null);
$view->with('themeBackgroundColor', Setting::get('style_background_color'));
$view->with('themeTextColor', Setting::get('style_text_color'));
$viewData = $view->getData();
$themeView = array_only($viewData, preg_grep('/^theme/', array_keys($viewData)));

View File

@ -45,11 +45,12 @@ class Repository
* Returns a setting from the database.
*
* @param string $name
* @param string $default
* @param bool $checkEnv
*
* @return string|null
*/
public function get($name, $checkEnv = true)
public function get($name, $default = null, $checkEnv = true)
{
// if we've not loaded the settings, load them now
if (!$this->settings) {
@ -65,6 +66,8 @@ class Repository
if ($checkEnv) {
return $this->settings[$name] = env(strtoupper($name));
}
return $default;
}
/**

View File

@ -142,7 +142,7 @@ if (!function_exists('formatted_date')) {
*/
function formatted_date($date)
{
$dateFormat = Setting::get('date_format') ?: 'jS F Y';
$dateFormat = Setting::get('date_format', 'jS F Y');
return (new Date($date))->format($dateFormat);
}