Different .env settings?

How do I specify different settings for different development environments?

I can see the current environment is set by APP_ENV=local in .env

and after reading the docs I can see it's not recommended to version control the .env (which makes sense).

So, I guess any setting switching needs to happen in app.php

Is that right?

I'd like to be able to switch the debug mode and my mail settings. So, when I'm developing locally debug would be on and mail would be run via Mailtrap.

I've got these settings set up to work locally, but I was wondering how I'd go about editing app.php, so I only need to edit the APP_ENV value in .env to switch various settings on and off with one value change.

I've looked at the docs and there's a link to the Laravel docs

It shows this example:

if (App::environment('local')) {
    // The environment is local
}

Unfortunately, I can't seem to get this to work in app.php

Answered by Rob de Kort!
>>>>>>> Answered <<<<<<<
1 Reply
2 Followers