Load differenet .env file in laravel
public function bootstrap() { app()->loadEnvironmentFrom('.env.test'); parent::bootstrap(); }
Here is what the above code is Doing:
1. We’re overriding the bootstrap() method of the TestCase class.
2. We’re loading the .env.test file.
3. We’re calling the parent bootstrap() method.
Now, when we run our tests, the .env.test file will be loaded.