settings, $key, null) : app()->settings; // if settings null means that key not found throw_if($settings === null, 'Exception', "Undefined enum '{$key}'"); // if settings value is array its mean that user want to use it as collection return is_array($settings) ? collect($settings) : $settings; }