26
26
use Qubus \Injector \ServiceProvider \Serviceable ;
27
27
use ReflectionException ;
28
28
29
- use function Codefy \Framework \Helpers \env ;
30
29
use function get_class ;
31
30
use function is_string ;
32
31
use function rtrim ;
@@ -153,7 +152,7 @@ public function getDbConnection(): Connection
153
152
/** @var ConfigContainer $config */
154
153
$ config = $ this ->make (name: 'codefy.config ' );
155
154
156
- $ connection = env (key: 'DB_CONNECTION ' , default: ' default ' );
155
+ $ connection = $ config -> getConfigKey (key: 'database. default ' );
157
156
158
157
return DB ::connection ([
159
158
'driver ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.driver " ),
@@ -167,7 +166,6 @@ public function getDbConnection(): Connection
167
166
'username ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.username " ),
168
167
'password ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.password " ),
169
168
'dbname ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.dbname " ),
170
- 'prefix ' => $ config ->getConfigKey (key: "database.connections. {$ connection }.prefix " , default: '' ),
171
169
]);
172
170
}
173
171
@@ -177,15 +175,7 @@ public function getDbConnection(): Connection
177
175
*/
178
176
public function getDB (): ?OrmBuilder
179
177
{
180
- /** @var ConfigContainer $config */
181
- $ config = $ this ->make (name: 'codefy.config ' );
182
-
183
- $ connection = env (key: 'DB_CONNECTION ' , default: 'default ' );
184
-
185
- return new OrmBuilder (
186
- connection: $ this ->getDbConnection (),
187
- tablePrefix: $ config ->getConfigKey (key: "database.connections. {$ connection }.prefix " , default: '' )
188
- );
178
+ return new OrmBuilder (connection: $ this ->getDbConnection ());
189
179
}
190
180
191
181
/**
0 commit comments