예제 #1
0
파일: Repository.php 프로젝트: n0mer/Cachet
 /**
  * Creates or updates a setting value.
  *
  * @param string $name
  * @param string $value
  */
 public function set($name, $value)
 {
     // save the change to the db
     $this->model->updateOrCreate(compact('name'), compact('value'));
     // if we've loaded the settings, persist this change
     if ($this->settings) {
         $this->settings[$name] = $value;
     }
 }
예제 #2
0
 /**
  * Updates a setting value.
  *
  * @param string      $name
  * @param string|null $value
  *
  * @return void
  */
 public function set($name, $value)
 {
     $this->stale = true;
     if ($value === null) {
         $this->model->where('name', $name)->delete();
     } else {
         $this->model->updateOrCreate(compact('name'), compact('value'));
     }
 }
예제 #3
0
 /**
  * Creates or updates a setting value.
  *
  * @param string      $name
  * @param string|null $value
  *
  * @return void
  */
 public function set($name, $value)
 {
     if ($value === null) {
         $this->model->where('name', $name)->delete();
         if ($this->settings && isset($this->settings[$name])) {
             unset($this->settings[$name]);
         }
     } else {
         $this->model->updateOrCreate(compact('name'), compact('value'));
         if ($this->settings) {
             $this->settings[$name] = $value;
         }
     }
 }