nxmad /
Larapay
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Nxmad\Larapay; |
||
| 6 | |||
| 7 | use Nxmad\Larapay\Contracts\Payments; |
||
| 8 | use Illuminate\Support\ServiceProvider; |
||
| 9 | |||
| 10 | class LarapayServiceProvider extends ServiceProvider |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Register Service Provider. |
||
| 14 | * |
||
| 15 | * @return void |
||
| 16 | */ |
||
| 17 | public function register() |
||
| 18 | { |
||
| 19 | $this->mergeConfigFrom($this->getConfigPath(), 'larapay'); |
||
| 20 | |||
| 21 | $this->app->singleton(Payments::class, function ($app) { |
||
| 22 | return new GatewayManager($app['config']); |
||
| 23 | }); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Boot Service Provider. |
||
| 28 | * |
||
| 29 | * @return void |
||
| 30 | */ |
||
| 31 | public function boot() |
||
| 32 | { |
||
| 33 | $this->publishes([ |
||
| 34 | $this->getDatabasePath() => database_path(), |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 35 | $this->getConfigPath() => config_path('larapay.php'), |
||
| 36 | ]); |
||
| 37 | |||
| 38 | $this->loadViewsFrom(__DIR__ . '/../files/views', 'larapay'); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Get default config path. |
||
| 43 | * |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | protected function getConfigPath(): string |
||
| 47 | { |
||
| 48 | return __DIR__ . '/../files/config/larapay.php'; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Get default database path. |
||
| 53 | * |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | protected function getDatabasePath(): string |
||
| 57 | { |
||
| 58 | return __DIR__ . '/../files/database'; |
||
| 59 | } |
||
| 60 | } |
||
| 61 |