From 8dfa2c0bcb4e4e455fd7a716d6efe713d87b868c Mon Sep 17 00:00:00 2001 From: Krishan Koenig Date: Thu, 14 Mar 2024 14:22:14 +0100 Subject: [PATCH] wip --- src/MollieServiceProvider.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/MollieServiceProvider.php b/src/MollieServiceProvider.php index a01235f..580ad32 100644 --- a/src/MollieServiceProvider.php +++ b/src/MollieServiceProvider.php @@ -17,24 +17,11 @@ class MollieServiceProvider extends ServiceProvider */ public function boot() { - $this->setupConfig(); - $this->extendSocialite(); - } - - /** - * Setup the config. - * - * @return void - */ - protected function setupConfig() - { - $source = realpath(__DIR__.'/../config/mollie.php'); - if ($this->app->runningInConsole()) { - $this->publishes([$source => config_path('mollie.php')]); + $this->publishes([__DIR__ . '/../config/mollie.php' => config_path('mollie.php')]); } - $this->mergeConfigFrom($source, 'mollie'); + $this->extendSocialite(); } /** @@ -62,18 +49,22 @@ protected function extendSocialite() */ public function register() { + $this->mergeConfigFrom(__DIR__ . '/../config/mollie.php', 'mollie'); + $this->app->singleton( MollieApiClient::class, function (Container $app) { $client = (new MollieApiClient(new MollieLaravelHttpClientAdapter)) - ->addVersionString('MollieLaravel/'.self::PACKAGE_VERSION); + ->addVersionString('MollieLaravel/' . self::PACKAGE_VERSION); - if (! empty($apiKey = $app['config']['mollie.key'])) { + if (!empty($apiKey = $app['config']['mollie.key'])) { $client->setApiKey($apiKey); } return $client; } ); + + $this->app->singleton(MollieManager::class); } }