예제 #1
0
 /**
  * Returns a setting from the database.
  *
  * @param string      $name
  * @param string|null $default
  *
  * @return string|null
  */
 public function get($name, $default = null)
 {
     if (!$this->settings) {
         $this->settings = $this->model->all()->pluck('value', 'name');
     }
     if (!empty($this->settings[$name])) {
         return $this->settings[$name];
     }
     return $default;
 }
예제 #2
0
 /**
  * Returns a setting from the database.
  *
  * @param string      $name
  * @param string|null $default
  *
  * @return string|null
  */
 public function get($name, $default = null)
 {
     // if we've not loaded the settings, load them now
     if (!$this->settings) {
         $this->settings = $this->model->all()->lists('value', 'name');
     }
     // if the setting exists and is not blank, return it
     if (!empty($this->settings[$name])) {
         return $this->settings[$name];
     }
     return $default;
 }
예제 #3
0
파일: Repository.php 프로젝트: n0mer/Cachet
 /**
  * Returns a setting from the database.
  *
  * @param string      $name
  * @param string|null $default
  * @param bool        $checkEnv
  *
  * @return string|null
  */
 public function get($name, $default = null, $checkEnv = true)
 {
     // if we've not loaded the settings, load them now
     if (!$this->settings) {
         $this->settings = $this->model->all()->lists('value', 'name');
     }
     // if the setting exists and is not blank, return it
     if (!empty($this->settings[$name])) {
         return $this->settings[$name];
     }
     // fallback to getenv if allowed to
     if ($checkEnv) {
         if ($this->settings[$name] = env(strtoupper($name))) {
             return $this->settings[$name];
         }
     }
     return $default;
 }
예제 #4
0
 /**
  * Returns a setting from the database.
  *
  * @return array
  */
 public function all()
 {
     return $this->model->all(['name', 'value'])->pluck('value', 'name')->toArray();
 }