Skip to content

Commit

Permalink
Update Model.php to prevent $sqliteConnection overrides when multip…
Browse files Browse the repository at this point in the history
…le models are booted
  • Loading branch information
ibrasho authored Mar 23, 2021
1 parent 736e382 commit 627801b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/model/src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Model extends Eloquent\Model

public static $schema = [];

protected static $sqliteConnection;
protected static $sqliteConnections = [];

protected static function boot()
{
Expand Down Expand Up @@ -143,12 +143,12 @@ public static function migrate($locale = null)

public static function resolveConnection($connection = null)
{
return static::$sqliteConnection;
return static::$sqliteConnections[static::class];
}

protected static function setSqliteConnection($database)
{
static::$sqliteConnection = app(ConnectionFactory::class)->make([
static::$sqliteConnections[static::class] = app(ConnectionFactory::class)->make([
'driver' => 'sqlite',
'database' => $database,
]);
Expand All @@ -158,4 +158,4 @@ public function usesTimestamps()
{
return false;
}
}
}

0 comments on commit 627801b

Please sign in to comment.