diff --git a/src/ManagerServiceProvider.php b/src/ManagerServiceProvider.php index b5817ad..9268dc0 100755 --- a/src/ManagerServiceProvider.php +++ b/src/ManagerServiceProvider.php @@ -35,6 +35,19 @@ public function register() $this->mergeConfigFrom($configPath, self::PACKAGE); $this->publishes([$configPath => config_path(self::PACKAGE . '.php')], 'config'); + $db_driver = config('database.default'); + + if ($db_driver === 'pgsql') { + $translatorRepository = 'Vsch\TranslationManager\Repositories\PostgresTranslatorRepository'; + } else { + $translatorRepository = 'Vsch\TranslationManager\Repositories\MysqlTranslatorRepository'; + } + + $this->app->bind( + 'Vsch\TranslationManager\Repositories\Interfaces\ITranslatorRepository', + $translatorRepository + ); + $this->app->singleton(self::PACKAGE, function ($app) { /* @var $manager \Vsch\TranslationManager\Manager */ $manager = $app->make('Vsch\TranslationManager\Manager');