Laravel developers, do you think one of the config files can be dependent on another config file? 🤔
Do you intend to use a config value from one file in one of the other files?
If so, I'd avoid this. You won't be able to use the `config` helper and maybe you'll even struggle to use the config manager at all from the container
Timing is also an issue - afaik configs aren't explicitly loaded in a specific order
You could `require/include` one file inside the other:
$appConfig = require __DIR__."/app.php";
return [
'new_key' => $appConfig['key'];
];
But you still won't have the conveniences of the config helper, so it's pretty ugly
Also, I'm not sure if that will play nicely with config caching
Generally, I would avoid this. Perhaps even consider it a smell, because you're essentially duplicating a config value - try to get to the root of why you're reaching for that as a solution and you may find that there's a more fundamental solution to the problem you're having
Hey all!
@simonhamp I think your suggestions works just fine, in regard to caching.
To make it more beautiful, I would extract the logic to a Class, on a static method, or bound to the Servicecontainer.
I think I understand @MrPunyapal
This probably could be done at the `.env` level.
I think we should materialize to better understand.
I'll start with something:
A config URL, and something related to a domain.
Instead of doing this at config level, maybe at env level:
APP_DOMAIN=example.com
APP_URL=https://${APP_DOMAIN}
Have more sophisticated examples?
1st
// mail.php
Has env('APP_NAME') right 👀
2nd
Also VITE_APP_NAME=${APP_NAME} too
3rd
Middleware 💪 not so good not so bad...
cc: @simonhamp