I'm currently migrating a legacy system to laravel and I'm facing an issue regarding using additional parameters while connecting to the database.
Below is the current code:
try {
$dns = "pgsql:host=<HOST>;port=<NUMBER_PORT>;dbname=<DB_NAME>";
$options = [PDO::ATTR_PERSISTENT => true];
$this->driver = new PDO($dns, <DB_USERNAME>, <DB_PASSWORD>, $options);
$this->driver->query("SET app.current_tenant = {<TENANT_ID>}");
$this->driver->query("SET app.current_institution = {<INSTITUTION_ID>}");
$this->driver->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
echo $e->getMessage();
}
My question is: how to set the app.current_tenant and app.current_institution parameters when connecting to the database in Laravel.