summaryrefslogtreecommitdiff
path: root/src/Database/DatabaseServiceProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Database/DatabaseServiceProvider.php')
-rw-r--r--src/Database/DatabaseServiceProvider.php16
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);
}
/**