I'm doing a laravel project, when migrate with port 5432 it shows me could not connect error so I change to port 54320 in .env file. Everything seems okay till I make some test query and Homestead.test/api/test displays could not connect error again. Switch back to 5432 and everything is okay. I can only migrate or seed with port 54320 and make some api query with 5432. Here is my .env file.
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=54320
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret