1
0

HorizonServiceProvider.php 1004 B

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