29 lines
1.0 KiB
PHP
29 lines
1.0 KiB
PHP
<?php
|
|
|
|
if (!function_exists('timebank_config')) {
|
|
/**
|
|
* Get platform-specific configuration value
|
|
*
|
|
* This function dynamically loads configuration from the file specified
|
|
* in the TIMEBANK_CONFIG environment variable (config app.timebank_config, defaults to 'timebank-default').
|
|
*
|
|
* @param string $key Configuration key in dot notation (e.g., 'profiles.user.limit_max')
|
|
* @param mixed $default Default value if key is not found
|
|
* @return mixed
|
|
*
|
|
* @example
|
|
* // Get user profile limit_max from config/{TIMEBANK_CONFIG}.php
|
|
* $limitMax = timebank_config('profiles.user.limit_max');
|
|
*
|
|
* // With a default value
|
|
* $limitMax = timebank_config('profiles.user.limit_max', 6000);
|
|
*/
|
|
function timebank_config($key, $default = null)
|
|
{
|
|
// Read through config, not env(): env() returns null once the config is cached
|
|
$configName = config('app.timebank_config', 'timebank-default');
|
|
|
|
return config($configName . '.' . $key, $default);
|
|
}
|
|
}
|