1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
-
-
- namespace MirfalahTech\Laravel\Payment;
-
-
- use Illuminate\Contracts\Config\Repository;
- use Illuminate\Contracts\Container\BindingResolutionException;
- use Illuminate\Contracts\Foundation\Application;
- use Illuminate\Support\ServiceProvider;
- use MirfalahTech\Laravel\Payment\Manager\PaymentManager;
-
- class PaymentServiceProvider extends ServiceProvider
- {
- /**
- * @throws BindingResolutionException
- */
- public function boot()
- {
- $config_path = realpath(__DIR__ . '/../config/payment.php');
-
- /** @var Repository $config */
- $config = $this->app->make('config');
-
- /** @noinspection PhpIncludeInspection */
- $config->set('payment', array_merge(
- require $config_path,
- $config->get('payment', [])
- ));
-
- $this->app->singleton('payment', function (Application $app) use ($config) {
- return new PaymentManager($app, $config->get('payment.default'));
- });
-
- $this->app->alias('payment', PaymentManager::class);
-
- $this->publishes([
- $config_path => $this->app->configPath('payment.php')
- ], 'config');
- }
- }
|