T.Arslan
T.Arslan

Reputation: 123

Access to laravel .env file

Hi I am developing an application with laravel 5.5. I want to build a setup similar to Wordpress, and I want to automatically save the database information to the .env file, so that's how I do it, or how to access the .env file.

Upvotes: 4

Views: 158

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163898

You can prepare the contents of the .env file and save it:

\File::put(base_path('.env'), $contents);

But I'd say it's a bad idea to do that. You should keep the data in DB or config files.

Upvotes: 5

Related Questions