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.

44 lines
1.1 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\SocketChannel;
  6. use Illuminate\Notifications\ChannelManager;
  7. use Illuminate\Support\Facades\Notification;
  8. use Illuminate\Support\ServiceProvider;
  9. use GuzzleHttp\Client as HttpClient;
  10. class AppServiceProvider extends ServiceProvider
  11. {
  12. /**
  13. * Register any application services.
  14. *
  15. * @return void
  16. */
  17. public function register()
  18. {
  19. Notification::resolved(function (ChannelManager $service) {
  20. $service->extend('fcm', function ($app) {
  21. return new FcmChannel(new HttpClient, config('fcm.key'));
  22. });
  23. $service->extend('socket', function ($app) {
  24. return new SocketChannel(new HttpClient, config('socket.url'));
  25. });
  26. $service->extend('db', function ($app) {
  27. return new DBChannel();
  28. });
  29. });
  30. }
  31. /**
  32. * Bootstrap any application services.
  33. *
  34. * @return void
  35. */
  36. public function boot()
  37. {
  38. //
  39. }
  40. }