From a5671b1b89e692f55d0b1a382e93539129eb731d Mon Sep 17 00:00:00 2001 From: Dusan <51193287+Revolta77@users.noreply.github.com> Date: Mon, 15 Jun 2020 02:07:49 +0200 Subject: [PATCH] Laravel 7 -> fix Interface is not instantiable --- src/ManagerServiceProvider.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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');