laravel/laravel — pull request #1556 by mhaszprunar (2013-01-01 13:52:50+00:00)
Title: Added method @render_with_vars to allow manual passing of variables

This method allows you to use @render (meaning that no variales are
inherited in the render view) but with the ability to pass in variables.
This feature is needed if you want to use recursion in your views (currently not possible because of the reuse of variable names in @include)

Example how to use recursion:

// view "things"
@foreach($things->children as $thing)
Name: {{ $this->name }}
@if($thing->hasChildren())
Children:
@render_with_vars('things')->with('things',$thing)
@endif
@endforeach

Note: I was not sure about the naming of the method. It does not inherit ALL variables from the current view (like @include does) but I pass in some variables. So the name could also be @include_limited or similar but I thought that to use @render (which does NOT inherit anything) and giving more options was more logical.