Esempio n. 1
0
 /**
  * Loads all settings.
  *
  * @return collection
  */
 public function fetchSettings()
 {
     switch (env('CACHE_DRIVER')) {
         case "file":
         case "database":
             return SiteSetting::getAll();
             // We only cache settings when we are using a memory cache.
             // Anything else is slower than the query.
         // We only cache settings when we are using a memory cache.
         // Anything else is slower than the query.
         default:
             return Cache::remember('site.settings', 30, function () {
                 return SiteSetting::getAll();
             });
     }
 }
Esempio n. 2
0
 /**
  * Returns an system option's value.
  *
  * @param  string  $option
  * @return string|null
  */
 public function option($option_name)
 {
     if (!isset($this->options)) {
         $this->options = SiteSetting::getAll();
     }
     foreach ($this->options as $option) {
         if ($option->option_name == $option_name) {
             return $option->option_value;
         }
     }
     return null;
 }