I want to access the database connection details which are included in an external package's config file.
However, this does not seem to be working for me.
dd(Config::get('vendor/package::database.connection1.database'));
// > null
The config file is called database.php
and is imported via composer in the following path: vendor/package/config/database.php
m which looks like:
return [
'connection1' => [
'driver' => 'mysql',
'host' => env('CONN1_HOST','SomeIPHere'),
'port' => env('CONN1_PORT', '3306'),
'database' => env('CONN1_DATABASE', 'db1'),
'username' => env('CONN1_USERNAME', 'user1'),
'password' => env('CONN1_PASSWORD', 'pass1'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'connection2' => [
'driver' => 'mysql',
'host' => env('CONN2_HOST','SomeIPHere'),
'port' => env('CONN2_PORT', '3306'),
'database' => env('CONN2_DATABASE', 'db2'),
'username' => env('CONN2_USERNAME', 'user2'),
'password' => env('CONN2_PASSWORD', 'pass2'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
];
What is the best way to get the value of ie connection1.database, given that the above way did not work? Is publishing it via php artisan vendor:publish
essential?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire