flatten
flatten copied to clipboard
Pass view arguments to the internal function of cache section
(copied from #29)
For such case in Laravel when we create view with arguments, such us:
View::make('layouts.index')->with('categories', $categories)
have defined layouts/index.blade.php
like this:
<html><body>
<h1>My page title</h1>
@include('partials.menu')
<section id="page-content> ... </section>
</body></html>
and want to use $categories
in menu
partial:
@cache('menu', 10)
<ul>
@foreach ($categories as $category)
<li>{{ $category['name'] }}</li>
@endforeach
</ul>
@endcache
the index
view didn't pass it's arguments to the menu
partial so the commit fixes it. Not sure if it's the best way but it sure works for me.
Looks good! Smart way to solve this. Can you add a quick test for this in the TemplatingTest class? With and without arguments passed to section
I'm not sure how would you like to look like that test, so please do it yourself.