0

I am having problems with connection my postgresql to php laravel project.

There is no Exception or QueryException.

Every query returns null or empty.

For example

DB::table('aaa')->insertGetId($data); //return null

DB::table('aaa')->select()->get(); //returns empty

DB::table('aaa')->select()->first(); //returns null

I am sure that there is a data and table name is correct.

This is my .env file

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=denden
DB_USERNAME=postgres
DB_PASSWORD=123456

this is my database.php file

'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', 'forge'),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',

I am not having any error when I make changes on .env file such as I am giving non-existing database name or wrong password and username. Only error returning is when if I change Connection name.

Arfeo
  • 870
  • 7
  • 20

0 Answers0