TrustedProxyServiceProvider.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Fideloper\Proxy;
  3. use Illuminate\Foundation\Application as LaravelApplication;
  4. use Illuminate\Support\ServiceProvider;
  5. use Laravel\Lumen\Application as LumenApplication;
  6. class TrustedProxyServiceProvider extends ServiceProvider
  7. {
  8. /**
  9. * Boot the service provider.
  10. *
  11. * @return void
  12. */
  13. public function boot()
  14. {
  15. $source = realpath($raw = __DIR__.'/../config/trustedproxy.php') ?: $raw;
  16. if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
  17. $this->publishes([$source => config_path('trustedproxy.php')]);
  18. } elseif ($this->app instanceof LumenApplication) {
  19. $this->app->configure('trustedproxy');
  20. }
  21. if ($this->app instanceof LaravelApplication && ! $this->app->configurationIsCached()) {
  22. $this->mergeConfigFrom($source, 'trustedproxy');
  23. }
  24. }
  25. /**
  26. * Register the service provider.
  27. *
  28. * @return void
  29. */
  30. public function register()
  31. {
  32. //
  33. }
  34. }