HorizonServiceProvider.php 898 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Support\Facades\Gate;
  4. use Laravel\Horizon\Horizon;
  5. use Laravel\Horizon\HorizonApplicationServiceProvider;
  6. class HorizonServiceProvider extends HorizonApplicationServiceProvider
  7. {
  8. /**
  9. * Bootstrap any application services.
  10. */
  11. public function boot(): void
  12. {
  13. parent::boot();
  14. // Horizon::routeSmsNotificationsTo('15556667777');
  15. // Horizon::routeMailNotificationsTo('example@example.com');
  16. // Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
  17. }
  18. /**
  19. * Register the Horizon gate.
  20. *
  21. * This gate determines who can access Horizon in non-local environments.
  22. */
  23. protected function gate(): void
  24. {
  25. Gate::define('viewHorizon', function ($user) {
  26. return in_array($user->email, [
  27. //
  28. ]);
  29. });
  30. }
  31. }