Skip to content

Commit 4dd8d82

Browse files
authored
[10.x] Add public path to application contract (#45969)
* Add publicPath function to Application contract * Update public_path helper to use Application publicPath
1 parent 261c3a9 commit 4dd8d82

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/Illuminate/Contracts/Foundation/Application.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public function databasePath($path = '');
5353
*/
5454
public function langPath($path = '');
5555

56+
/**
57+
* Get the path to the public directory.
58+
*
59+
* @param string $path
60+
* @return string
61+
*/
62+
public function publicPath($path = '');
63+
5664
/**
5765
* Get the path to the resources directory.
5866
*

src/Illuminate/Foundation/Application.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,9 @@ public function useLangPath($path)
481481
*/
482482
public function publicPath($path = '')
483483
{
484-
return $this->joinPaths($this->basePath('public'), $path);
484+
$publicPath = $this->bound('path.public') ? $this->make('path.public') : $this->basePath('public');
485+
486+
return $this->joinPaths($publicPath, $path);
485487
}
486488

487489
/**

src/Illuminate/Foundation/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ function precognitive($callable = null)
628628
*/
629629
function public_path($path = '')
630630
{
631-
return app()->joinPaths(app()->make('path.public'), $path);
631+
return app()->publicPath($path);
632632
}
633633
}
634634

0 commit comments

Comments
 (0)