Esempio n. 1
0
 /**
  * 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;
     }
 }
Esempio n. 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'));
     }
 }
Esempio n. 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;
         }
     }
 }