Commit 090bf9b3 by Taylor Otwell

Added "shares" method to view instance.

parent e96f75e8
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
Route::get('/', function() Route::get('/', function()
{ {
$content = file_get_contents(path('app').'views/home/index.php');
$matches = preg_match('/(\s*)@forelse(\s*\(.*\))(.+)@endforelse/m', $content);
die(var_dump($matches));
return View::make('home.index'); return View::make('home.index');
}); });
......
...@@ -101,6 +101,10 @@ ...@@ -101,6 +101,10 @@
<h3>Learn the terrain.</h3> <h3>Learn the terrain.</h3>
@forelse ($something as $something)
Do Stuff.
@endforelse
<p> <p>
You've landed yourself on our default home page. The route that You've landed yourself on our default home page. The route that
is generating this page lives at: is generating this page lives at:
......
...@@ -387,6 +387,21 @@ class View implements ArrayAccess { ...@@ -387,6 +387,21 @@ class View implements ArrayAccess {
* *
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
* @return View
*/
public function shares($key, $value)
{
static::share($key, $value);
return $this;
}
/**
* Add a key / value pair to the shared view data.
*
* Shared view data is accessible to every view created by the application.
*
* @param string $key
* @param mixed $value
* @return void * @return void
*/ */
public static function share($key, $value) public static function share($key, $value)
......
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