ThirdPartyApiServiceServiceProvider.php 857 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Providers;
  3. use App\ThirdPartyApi\Aligo\Services\AligoSmsService;
  4. use App\ThirdPartyApi\Barobill\Adapter\BarobillAccountAdapter;
  5. use App\ThirdPartyApi\Barobill\Services\BarobillAccountService;
  6. use App\ThirdPartyApi\Barobill\Services\BarobillSmsService;
  7. use Illuminate\Support\ServiceProvider;
  8. class ThirdPartyApiServiceServiceProvider extends ServiceProvider
  9. {
  10. public function register()
  11. {
  12. $this->app->singleton('App\ThirdPartyApi\Interfaces\AccountInterface', function() {
  13. $barobillAccountService = new BarobillAccountService(app()->make('App\Services\CallApiService'));
  14. return new BarobillAccountAdapter($barobillAccountService);
  15. });
  16. $this->app->singleton('App\ThirdPartyApi\Interfaces\SmsInterface', function() {
  17. return new AligoSmsService();
  18. });
  19. }
  20. }