diff --git a/src/TrustedProxies.php b/src/TrustedProxies.php index 61f6a099e3b4367c03408fc87ca5e2ab55176061..0c253cfccd8af907c3bcbe82234bcb1afff44126 100644 --- a/src/TrustedProxies.php +++ b/src/TrustedProxies.php @@ -19,7 +19,7 @@ class TrustedProxies * * @param \Illuminate\Contracts\Config\Repository $config */ - public function __construction(Repository $config) { + public function __construct(Repository $config) { $this->config = $config; } @@ -47,7 +47,7 @@ class TrustedProxies * @param array $clientIpAddresses Array of client IP addresses. * @return array An array of IP addresses of the trusted proxies. */ - protected function getTrustedProxies(array $clientIpAddress = []) { + protected function getTrustedProxies(array $clientIpAddresses = []) { $trustedProxies = $this->config->get('trustedproxies.proxies'); // Trust all proxies diff --git a/src/TrustedProxiesServiceProvider.php b/src/TrustedProxiesServiceProvider.php index 867d016a2c111c44a31dd58dc0abc8a55fdcc100..069d2f354e5089567cf7bdb9a2ac24faae284482 100644 --- a/src/TrustedProxiesServiceProvider.php +++ b/src/TrustedProxiesServiceProvider.php @@ -2,6 +2,7 @@ namespace CodingAllNight\Proxy; +use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; class TrustedProxiesServiceProvider extends ServiceProvider @@ -15,7 +16,9 @@ class TrustedProxiesServiceProvider extends ServiceProvider $config = realpath(__DIR__ . '/../config/trustedproxies.php'); // Publish the config to the application's config directory - $this->publishes([$config => config_path('trustedproxies.php')]); + if ($this->app instanceof Application && $this->app->runningInConsole()) { + $this->publishes([$config => config_path('trustedproxies.php')]); + } // Merge the config $this->mergeConfigFrom($config, 'trustedproxies');