File: /home/dnlightw-124/dn.lightweb.kr/app/Helpers/helpers.php
<?php
declare(strict_types=1);
use Rawilk\Settings\Settings;
use Rawilk\Settings\Support\Context;
if (! function_exists('siteConfigs')) {
function siteConfigs($key = null, $default = null, $context = null)
{
/** @var Settings $siteConfigs */
$siteConfigs = app(Settings::class);
// If nothing is passed in to the function, simply return the settings instance.
if ($key === null) {
return $siteConfigs;
}
// If an array is passed, we are setting values.
if (is_array($key)) {
foreach ($key as $name => $value) {
if ($context instanceof Context) {
$siteConfigs->context($context);
}
$siteConfigs->set(key: $name, value: $value);
}
return null;
}
if ($context instanceof Context || is_bool($context)) {
$siteConfigs->context($context);
}
return $siteConfigs->get(key: $key, default: $default);
}
}