API

Settings

/**
 * Set the context for the current operation.
 * Omit or set $context to null to remove context.
 *
 * @param \Rawilk\Settings\Support\Context|null $context
 * @return \Rawilk\Settings\Settings
 */
public function context(Context $context = null): self
/**
 * Remove a persisted setting from storage.
 *
 * @param string|\BackedEnum $key
 * @return void
 */
public function forget(string|BackedEnum $key)
/**
 * Retrieve a setting from storage.
 *
 * @param string|\BackedEnum $key
 * @param mixed $default
 * @return mixed
 */
public function get(string|BackedEnum $key, $default = null)
/**
 * Retrieve all stored settings.
 *
 * @param array|string|null $keys Only return a subset of settings.
 * @return \Illuminate\Support\Collection<int, object>
 */
public function all($keys = null): \Illuminate\Support\Collection
/**
 * Determine if a setting has been persisted to storage.
 *
 * @param string|\BackedEnum $key
 * @return bool
 */
public function has(string|BackedEnum $key): bool
/**
 * Persist a setting to storage.
 * Updates already persisted settings.
 *
 * @param string $key
 * @param mixed $value
 * @return void
 */
public function set(string $key, $value = null)
/**
 * Determine if a setting is set to a false value.
 * Returns true if the value is false, '0', or 0.
 *
 * @param string|\BackedEnum $key
 * @param bool|int|string $default
 * @return bool
 */
public function isFalse(string|BackedEnum $key, $default = false): bool
/**
 * Determine if a setting is set to a truthy value.
 * Returns true if the value is true, '1', or 1.
 *
 * @param string|\BackedEnum $key
 * @param bool|int|string $default
 * @return bool
 */
public function isTrue(string|BackedEnum $key, $default = true): bool
/**
 * Flush all settings from storage.
 *
 * @param array|string|null $keys Only flush a subset of settings.
 * @return void
 */
public function flush($keys = null): void
/**
 * Get the correct cache key for a given setting.
 *
 * @param string|\BackedEnum $key
 * @return string
 */
public function cacheKeyForSetting(string|BackedEnum $key): string
Previous
Enums
Caught a mistake? Suggest an edit on GitHub