Skip to content

Commit af3a651

Browse files
committed
add view path method
1 parent d9e28dc commit af3a651

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Illuminate/Foundation/Application.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,21 @@ public function resourcePath($path = '')
486486
return $this->basePath.DIRECTORY_SEPARATOR.'resources'.($path ? DIRECTORY_SEPARATOR.$path : $path);
487487
}
488488

489+
/**
490+
* Get the path to the views directory.
491+
*
492+
* This method returns the first configured path in the array of view paths.
493+
*
494+
* @param string $path
495+
* @return string
496+
*/
497+
public function viewPath($path = '')
498+
{
499+
$basePath = $this['config']->get('view.paths')[0];
500+
501+
return rtrim($basePath, DIRECTORY_SEPARATOR).($path ? DIRECTORY_SEPARATOR.$path : $path);
502+
}
503+
489504
/**
490505
* Get the path to the environment file directory.
491506
*

0 commit comments

Comments
 (0)