diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-30 19:31:14 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-30 19:33:14 +0200 |
commit | b46207f91176cf944284c01c213d3f69075377a4 (patch) | |
tree | 3d04a46c84c8b66b2d5a56a851249fde80257e28 /src/Database/DatabaseServiceProvider.php | |
parent | 6187eed3bb08f200050a3078bd762b5731dfbe78 (diff) | |
parent | 0b0890f425ced27b2204a046296de4cccdac4eb8 (diff) |
Merge remote-tracking branch 'MyIgel/session'
Diffstat (limited to 'src/Database/DatabaseServiceProvider.php')
-rw-r--r-- | src/Database/DatabaseServiceProvider.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/Database/DatabaseServiceProvider.php b/src/Database/DatabaseServiceProvider.php index 7328bc4e..b3c33588 100644 --- a/src/Database/DatabaseServiceProvider.php +++ b/src/Database/DatabaseServiceProvider.php @@ -5,6 +5,7 @@ namespace Engelsystem\Database; use Engelsystem\Container\ServiceProvider; use Exception; use Illuminate\Database\Capsule\Manager as CapsuleManager; +use Illuminate\Database\Connection as DatabaseConnection; use PDOException; class DatabaseServiceProvider extends ServiceProvider @@ -30,14 +31,25 @@ class DatabaseServiceProvider extends ServiceProvider $capsule->bootEloquent(); $capsule->getConnection()->useDefaultSchemaGrammar(); + $pdo = null; try { - $capsule->getConnection()->getPdo(); + $pdo = $capsule->getConnection()->getPdo(); } catch (PDOException $e) { $this->exitOnError(); } - $this->app->instance('db', $capsule); + $this->app->instance(CapsuleManager::class, $capsule); + $this->app->instance(Db::class, $capsule); Db::setDbManager($capsule); + + $connection = $capsule->getConnection(); + $this->app->instance(DatabaseConnection::class, $connection); + + $database = $this->app->make(Database::class); + $this->app->instance(Database::class, $database); + $this->app->instance('db', $database); + $this->app->instance('db.pdo', $pdo); + $this->app->instance('db.connection', $connection); } /** |