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.

48 lines
1.3 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(new HttpClient, config('smsirlaravel.webservice-url'));
  32. });
  33. });
  34. }
  35. /**
  36. * Bootstrap any application services.
  37. *
  38. * @return void
  39. */
  40. public function boot()
  41. {
  42. //
  43. }
  44. }