Pass directory into View:: file method.

This commit is contained in:
Taylor Otwell 2012-03-26 08:27:53 -05:00
parent 263d6145a7
commit 973da34bc0
2 changed files with 7 additions and 6 deletions

View File

@ -92,7 +92,7 @@
Event::listen(View::loader, function($bundle, $view)
{
return View::file($bundle, $view);
return View::file($bundle, $view, path('app').'views');
});
/*

View File

@ -132,20 +132,21 @@ protected function path($view)
*
* @param string $bundle
* @param string $view
* @param string $directory
* @return string
*/
public static function file($bundle, $view)
public static function file($bundle, $view, $directory)
{
$root = Bundle::path($bundle).'views/';
$directory = str_finish($directory, DS);
// Views may have either the default PHP fiel extension of the "Blade"
// Views may have either the default PHP file extension of the "Blade"
// extension, so we will need to check for both in the view path
// and return the first one we find for the given view.
if (file_exists($path = $root.$view.EXT))
if (file_exists($path = $directory.$view.EXT))
{
return $path;
}
elseif (file_exists($path = $root.$view.BLADE_EXT))
elseif (file_exists($path = $directory.$view.BLADE_EXT))
{
return $path;
}