public static function remove($key) { if (!empty($key)) { return self::$app_options->where('key', $key)->delete(); } return false; }
/** * 当前属性以特定字符串结尾 * @param $attribute * @param string|null $value * @return static */ public function whereEndsWith($attribute, string $value) { if (is_empty_string($value)) { return $this; } $this->original->where($attribute, 'like', '%' . trim($value, '%')); return $this; }
/** * Return a Setting. * * @param string $key * * @return mixed */ public function getSetting($key) { if (!$this->settings) { $this->getSettings(); } if ($this->settings instanceof EloquentCollection && $this->settings->where('key', $this->key($key))->first()) { return $this->settings->where('key', $this->key($key))->first(); } return new Setting(['key' => $this->key($key), 'value' => $this->getDefaultValue($key)]); }
/** * Get a setting by its handle. * * @param string $handle * * @return Setting */ public function get($handle) { $this->setting = $this->items->where('handle', $handle)->first(); return $this->setting; }