From 3382da1878be2df112c2f39ef0100870bad3110c Mon Sep 17 00:00:00 2001 From: Andrey Filippov Date: Wed, 17 Nov 2021 13:04:04 +0400 Subject: [PATCH 1/3] add $path argument to storagePath() --- src/Illuminate/Foundation/Application.php | 6 ++++-- src/Illuminate/Foundation/helpers.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 83b4886f09f3..c69422b8ccdf 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -454,11 +454,13 @@ public function publicPath() /** * Get the path to the storage directory. * + * @param string $path * @return string */ - public function storagePath() + public function storagePath($path = '') { - return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage'; + return ($this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage') + .($path ? DIRECTORY_SEPARATOR.$path : ''); } /** diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index bd879a8f6d61..7e0bdd1c3663 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -800,7 +800,7 @@ function session($key = null, $default = null) */ function storage_path($path = '') { - return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path); + return app()->storagePath($path); } } From 4ddcaa7a74b290f51edafc6025c6019ecd16aada Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 17 Nov 2021 08:25:47 -0600 Subject: [PATCH 2/3] Update Application.php --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index c69422b8ccdf..e97976df5f82 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -460,7 +460,7 @@ public function publicPath() public function storagePath($path = '') { return ($this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage') - .($path ? DIRECTORY_SEPARATOR.$path : ''); + .($path ? DIRECTORY_SEPARATOR.$path : ''); } /** From 9e10d9776a5453436ae8aa997722751b5d9ad168 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 17 Nov 2021 08:37:50 -0600 Subject: [PATCH 3/3] formatting --- src/Illuminate/Contracts/Foundation/Application.php | 3 ++- src/Illuminate/Foundation/Application.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Contracts/Foundation/Application.php b/src/Illuminate/Contracts/Foundation/Application.php index 74af47c751cb..e4a0bc20cd6c 100644 --- a/src/Illuminate/Contracts/Foundation/Application.php +++ b/src/Illuminate/Contracts/Foundation/Application.php @@ -56,9 +56,10 @@ public function resourcePath($path = ''); /** * Get the path to the storage directory. * + * @param string $path * @return string */ - public function storagePath(); + public function storagePath($path = ''); /** * Get or check the current application environment. diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index e97976df5f82..c400e55861e5 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -460,7 +460,7 @@ public function publicPath() public function storagePath($path = '') { return ($this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage') - .($path ? DIRECTORY_SEPARATOR.$path : ''); + .($path ? DIRECTORY_SEPARATOR.$path : ''); } /**