public function loadEnvironmentConfig($environment) { $file = $this->app->config()['paths']['config']->expand('environments', $environment . '.php'); if (!is_file($file)) { throw new \InvalidArgumentException(sprintf("Configuration file for environment '%s' not found: %s", $environment, $file)); } $configurer = (require $file); $configurer($this->app->config()); if ($this->connectionManagerSetUp) { PersistedModel::connectionManager()->setDefaultConnection($environment); } }