You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. <?php
  2. namespace App\Providers;
  3. use App\Channels\DBChannel;
  4. use App\Channels\FcmChannel;
  5. use App\Channels\SmsChannel;
  6. use App\Channels\SocketChannel;
  7. use Illuminate\Notifications\ChannelManager;
  8. use Illuminate\Support\Facades\Notification;
  9. use Illuminate\Support\ServiceProvider;
  10. use GuzzleHttp\Client as HttpClient;
  11. class AppServiceProvider extends ServiceProvider
  12. {
  13. /**
  14. * Register any application services.
  15. *
  16. * @return void
  17. */
  18. public function register()
  19. {
  20. Notification::resolved(function (ChannelManager $service) {
  21. $service->extend('fcm', function ($app) {
  22. return new FcmChannel(new HttpClient, config('fcm.key'));
  23. });
  24. $service->extend('socket', function ($app) {
  25. return new SocketChannel(new HttpClient, config('socket.url'));
  26. });
  27. // $service->extend('db', function ($app) {
  28. // return new DBChannel();
  29. // });
  30. $service->extend('sms', function ($app) {
  31. return new SmsChannel(
  32. new HttpClient,
  33. config('smsirlaravel.webservice-url'),
  34. config('smsirlaravel.api-key'),
  35. config('smsirlaravel.secret-key'),
  36. );
  37. });
  38. });
  39. }
  40. /**
  41. * Bootstrap any application services.
  42. *
  43. * @return void
  44. */
  45. public function boot()
  46. {
  47. //
  48. }
  49. }