12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Support\Facades\App;
  4. use Illuminate\Support\Facades\Gate;
  5. use Illuminate\Support\Facades\URL;
  6. use Illuminate\Support\ServiceProvider;
  7. class AppServiceProvider extends ServiceProvider
  8. {
  9. /**
  10. * Register any application services.
  11. */
  12. public function register(): void
  13. {
  14. //
  15. }
  16. /**
  17. * Bootstrap any application services.
  18. */
  19. public function boot(): void
  20. {
  21. if (App::environment('production')) {
  22. URL::forceScheme('https');
  23. }
  24. Gate::before(function ($user, $ability) {
  25. if ($user->email == env("SUPER_ADMIN_ACCOUNT", "admin@ogilvy.com")) {
  26. return true; // Super admin always passes
  27. }
  28. // Continue to policy logic for other users
  29. return null; // Null lets the policy decide
  30. });
  31. }
  32. }