laravel-settings icon indicating copy to clipboard operation
laravel-settings copied to clipboard

ToDo : Get config file value if doesn't exist in Setting

Open AEK-BKF opened this issue 7 years ago • 1 comments

Hi,

Thank so much for this nice package, I've a suggestion : It's a good idea to add a function that retrieves a value from a file config when it doesn't exist in Setting table, Example: $value = Setting::get('file.name'); // It returns config('file.name').

Thanks :)

AEK-BKF avatar May 03 '17 13:05 AEK-BKF

Excellent idea.

The long one would be use the default value parameter, it's very redundant:

$value = Setting::get('file.name', config('file.name'));

perhaps adding a setFallback() method, and can be use like:

Settings::setFallback(function ($key, $default) {
    return config($key, $default);
});

what do you think? @AEK-BKF

youchenlee avatar May 18 '17 12:05 youchenlee