You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
486 B
14 lines
486 B
<?php
|
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
function setting($key) {
|
|
// if the key that user provided not exists then null return
|
|
$settings = $key != "" ? Arr::get(app()->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;
|
|
}
|