How does one change database for development and testing on local system without editing the .env file each time?
I have found it quite inconvenient to
For Laravel 5.5, the proper way to do this is create a testing environment file called .env.testing. Here, you can define your testing environment, including the database you want to use for testing...
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test DB
DB_USERNAME=test DB user
DB_PASSWORD=test DB password
Then run this command...
php artisan config:cache --env=testing
This will configure the cache to the .env.testing file parameters.
Here is a link to the documentation.