diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ab45914 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), + +## [Unreleased] +### Added +- This CHANGELOG.md file. +- Added the handling of config:cache artisan command by multiple cache config files + +## 1.1.0 - 2018-06-24 +### Added +- Initial version for Laravel 5.5. + +[Unreleased]: https://github.com/gecche/laravel-multidomain/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.2.0...v0.3.0 diff --git a/README.md b/README.md index c2778a9..5984ba2 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,20 @@ php artisan domain:update_env --domain_values='{"TOM_DRIVER":"TOMMY"}' adds the line `TOM_DRIVER=TOMMY` to all the found environment files. +#### config:cache artisan command +The config:cache artisan command can be used with this package in the same way as any other +artisan command. Be careful that in our setting the config:cache command generates +a file config.php file for each domain under which the command has been executed. +I.e. the command + ``` + php artisan config:cache --domain=site2.com + ``` +will generate the file + ``` + config-site2_com.php + ``` + + #### Further information At run-time, the current HTTP domain is maintained in the laravel container and can be accessed by its `domain()` method added by this package. diff --git a/src/Foundation/Application.php b/src/Foundation/Application.php index e8189ba..a5aa9d9 100644 --- a/src/Foundation/Application.php +++ b/src/Foundation/Application.php @@ -106,4 +106,16 @@ public function domainStoragePath() } + /** + * Get the path to the configuration cache file. + * + * @return string + */ + public function getCachedConfigPath() + { + $envFile = $this->environmentFile(); + if ($envFile && $envFile == '.env') + return $this->bootstrapPath().'/cache/config.php'; + return $this->bootstrapPath().'/cache/config-'.domain_sanitized($this['domain']).'.php'; + } }