Merge pull request #2663 from CachetHQ/cache-settings

Statically cache settings
This commit is contained in:
James Brooks
2017-07-26 14:23:23 -04:00
committed by GitHub

View File

@@ -25,7 +25,13 @@ if (!function_exists('setting')) {
*/
function setting($name, $default = null)
{
return app(Repository::class)->get($name, $default);
static $settings = [];
if (isset($settings[$name])) {
return $settings[$name];
}
return $settings[$name] = app(Repository::class)->get($name, $default);
}
}