phpzilla
asked on
Laravel 6 dynamic .env files based on user
How to do this. For laravel 6, read in dynamic .env files. If the user has role admin read in .env and .env.adminIf the user has role guest, read in .env and .env.guest
all of the environment variables need to be updated by reading in the .env.* files
all of the environment variables need to be updated by reading in the .env.* files
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Pretty sure you can't do what you your asking. The Env files are loaded right at app start-up, and amongst other things, set up your credentials for your DB. At the point they're loaded, there is no concept of a User, so there's no way to check that before loading.
If you explain what you're trying to achieve (and why), we can probably offer a suggestion. It may be that you store User (or Role) specific settings in the Database, or maybe you can get away with a Config file.
Without a context to your question, I can't really offer you any advice.