Skip to content

Commit

Permalink
[9.x] Fix \Illuminate\Support\Facades\App::storagePath() method ignor…
Browse files Browse the repository at this point in the history
…es $path argument (#39648)

* add $path argument to storagePath()

* Update Application.php

* formatting

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
afilippov1985 and taylorotwell authored Nov 17, 2021
1 parent e13132b commit 8f9ddea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Illuminate/Contracts/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 8f9ddea

Please sign in to comment.