How do I set the application_name as defined here http://www.postgresql.org/docs/9.1/static/libpq-connect.html, in Laravel? I see that you can do "SET application_name = 'application'" but this does not work for me. I also tried setting it in the app/config/database.php file in the 'connections' array. What am I doing wrong?
Asked
Active
Viewed 1,121 times
2 Answers
2
You have to put in the env file (/.env) the variable regarding the application name named DB_APPLICATION_NAME = ;
And you have to specify the following: Form Laravel version 5.5 you can add this row to the file /config/database.php at the bottom of the postgresql connection. 'application_name' => env('DB_APPLICATION_NAME', 'Laravel')
If you don't specify the app name in the .env file the application name will be taken from /config/database.php file.

zulyo
- 61
- 8
-
1Make sure your application name doesn't have any single quotes in it, because laravel doesn't quote or prepare those like you might expect. – Jay K Mar 23 '22 at 17:17
0
# database.php
'application_name' => env('DB_APPLICATION_NAME', 'Laravel')

DEV Tiago França
- 1,271
- 9
- 9