Added View::render_each and Blade shortcut.

This commit is contained in:
Taylor Otwell
2012-03-22 15:45:26 -05:00
parent 9df88c461b
commit 727b064bf7
2 changed files with 50 additions and 31 deletions

View File

@@ -18,6 +18,7 @@ class Blade {
'yields',
'section_start',
'section_end',
'render_each',
);
/**
@@ -238,6 +239,19 @@ class Blade {
return preg_replace('/@endsection/', '<?php \\Laravel\\Section::stop(); ?>', $value);
}
/**
* Rewrites Blade @render_each statements into View statements.
*
* @param string $value
* @return string
*/
protected static function compile_render_each($value)
{
$pattern = static::matcher('render_each');
return preg_replace($pattern, '$1<?php \\Laravel\\View::render_each$2; ?>', $value);
}
/**
* Get the regular expression for a generic Blade function.
*