Skip to content

Commit 8f9ddea

Browse files
[9.x] Fix \Illuminate\Support\Facades\App::storagePath() method ignores $path argument (#39648)
* add $path argument to storagePath() * Update Application.php * formatting Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent e13132b commit 8f9ddea

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/Illuminate/Contracts/Foundation/Application.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ public function resourcePath($path = '');
5656
/**
5757
* Get the path to the storage directory.
5858
*
59+
* @param string $path
5960
* @return string
6061
*/
61-
public function storagePath();
62+
public function storagePath($path = '');
6263

6364
/**
6465
* Get or check the current application environment.

src/Illuminate/Foundation/Application.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,13 @@ public function publicPath()
454454
/**
455455
* Get the path to the storage directory.
456456
*
457+
* @param string $path
457458
* @return string
458459
*/
459-
public function storagePath()
460+
public function storagePath($path = '')
460461
{
461-
return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage';
462+
return ($this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage')
463+
.($path ? DIRECTORY_SEPARATOR.$path : '');
462464
}
463465

464466
/**

src/Illuminate/Foundation/helpers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ function session($key = null, $default = null)
800800
*/
801801
function storage_path($path = '')
802802
{
803-
return app('path.storage').($path ? DIRECTORY_SEPARATOR.$path : $path);
803+
return app()->storagePath($path);
804804
}
805805
}
806806

0 commit comments

Comments
 (0)