Laravel 5 + PostgreSQL: "Database [postgres] not configured." Error

You have to enter your configuration in the .env file.

The configuration you made will only be loaded if they are not already defined in .env

You need to use pgsql instead of postgres.

DB_CONNECTION=pgsql
DB_HOST=localhost
DB_DATABASE=DB_NAME
DB_USERNAME=USER
DB_PASSWORD=PW 

I know this is an old question and it already has an answer; however, here is an small explanation why:

If you check your database.php in the config directory, you will see that you have few connections types, including pgsql. So, the key have to match to the DB_CONNECTION in .env file. You can definitely replace pqsql connection key with postgres, and it will work on the same way.

However, I would recommend replacing the value DB_CONNECTION, instead of modifying the config.

DB_CONNECTION=pgsql

Laravel sometimes caches your configurations. If you run into this problem while everything looks alright try running

php artisan config:cache