Skip to content

Commit

Permalink
chore: using connection factory
Browse files Browse the repository at this point in the history
  • Loading branch information
darkterminal committed Jul 13, 2024
1 parent 1ab763a commit 12fa9a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/LibSQLDriverServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use Turso\Driver\Laravel\Database\LibSQLConnection;
use Turso\Driver\Laravel\Database\LibSQLConnectionFactory;
use Turso\Driver\Laravel\Database\LibSQLConnector;

class LibSQLDriverServiceProvider extends PackageServiceProvider
Expand All @@ -24,9 +25,8 @@ public function configurePackage(Package $package): void
public function register(): void
{
parent::register();

$this->app->singleton(LibSQLConnector::class, function ($app) {
return new LibSQLConnector();
$this->app->singleton('db.factory', function ($app) {
return new LibSQLConnectionFactory($app);
});

$this->app->resolving('db', function (DatabaseManager $db) {
Expand All @@ -47,4 +47,4 @@ public function register(): void
});
});
}
}
}

0 comments on commit 12fa9a0

Please sign in to comment.