1

I set several ENV variables with Laravel Forge which are correctly picked up by the application. However artisan doesn't seem to pick up my environment. php artisan env returns:

Current application environment: local

In the nginx configuration I also have

fastcgi_param ENV "test";

This is how I detect my environment:

$env = $app->detectEnvironment(function () {
    return getenv('ENV') ?: 'local';
});

How can I have artisan think its in the test environment?

Ortixx
  • 833
  • 3
  • 10
  • 23

2 Answers2

0

Go to your laravel forge site and click on 'Edit Deploy Script'.

Change line 4 to

php artisan migrate --env=production

or whatever env you need.

You will need to do the same when running an artisan command in the console.

php artisan <command> --env=test
Robbie
  • 642
  • 1
  • 6
  • 12
0

Try to verify if your .env file is correctly configured. Take a look in your .env and set this:

APP_ENV=test

after that try to clear your configuration. Type this in your terminal:

php artisan config:clear

and to finish verify your environment with this:

php artisan env

I hope this help you.

Regards!