Commit 42f89146 authored by Taylor Otwell's avatar Taylor Otwell

Merge branch 'develop' of github.com:laravel/laravel into develop

parents 66cf43de 7ba97bc3
...@@ -110,12 +110,12 @@ class View implements ArrayAccess { ...@@ -110,12 +110,12 @@ class View implements ArrayAccess {
} }
/** /**
* Get the path to a given view on disk. * Allows people to check if a view passed in exists, handy for certain types of CMS development
* * @param string $view The view name (ex. site.home)
* @param string $view * @param boolean $return_path Setting to TRUE will return the path found if it exists
* @return string * @return string / boolean
*/ */
protected function path($view) public static function exists($view, $return_path = false)
{ {
list($bundle, $view) = Bundle::parse($view); list($bundle, $view) = Bundle::parse($view);
...@@ -127,6 +127,21 @@ class View implements ArrayAccess { ...@@ -127,6 +127,21 @@ class View implements ArrayAccess {
$path = Event::first(static::loader, array($bundle, $view)); $path = Event::first(static::loader, array($bundle, $view));
if ( ! is_null($path)) if ( ! is_null($path))
{
return $return_path ? $path : true;
}
return false;
}
/**
* Get the path to a given view on disk.
*
* @param string $view
* @return string
*/
protected function path($view)
{
if ($path = $this->exists($view,true))
{ {
return $path; return $path;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment