-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseServiceProvider.php
More file actions
41 lines (36 loc) · 958 Bytes
/
DatabaseServiceProvider.php
File metadata and controls
41 lines (36 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* @package framework
* @copyright Copyright (c) 2005-2020 The Regents of the University of California.
* @license http://opensource.org/licenses/MIT MIT
*/
namespace Qubeshub\Database;
use Hubzero\Base\ServiceProvider;
/**
* Database service provider
*/
class DatabaseServiceProvider extends ServiceProvider
{
/**
* Register the service provider
*
* @return void
*/
public function register()
{
$this->app['db'] = function($app)
{
// @FIXME: this isn't pretty, but it will shim the removal of the old mysql library calls from php
$driver = (Config::get('dbtype') == 'mysql') ? 'pdo' : Config::get('dbtype');
$options = [
'driver' => $driver,
'host' => Config::get('host'),
'user' => Config::get('user'),
'password' => Config::get('password'),
'database' => Config::get('db'),
'prefix' => Config::get('dbprefix')
];
return Driver::getInstance($options);
};
}
}