App\Services\Repositories\OptionRepository::get PHP Метод

get() публичный Метод

Get the specified option value.
public get ( string $key, mixed $default = null, boolean $bool = true ) : mixed
$key string
$default mixed
$bool boolean convert '0', '1' to bool value
Результат mixed
    public function get($key, $default = null, $bool = true)
    {
        if (!$this->has($key) && Arr::has(config('options'), $key)) {
            $this->set($key, config("options.{$key}"));
        }
        $value = Arr::get($this->items, $key, $default);
        if (!$bool) {
            return $value;
        }
        switch (strtolower($value)) {
            case 'true':
            case '1':
                return true;
            case 'false':
            case '0':
                return false;
            case 'null':
            case '(null)':
                return;
            default:
                return $value;
                break;
        }
    }

Usage Example

 /**
  * The id's of the enabled plugins.
  *
  * @return array
  */
 public function getEnabled()
 {
     return (array) json_decode($this->option->get('plugins_enabled'), true);
 }