I would like to add @continue
and @break
statements for my Blade engine in order to control my loops.
I've seen into the sources an extend
function for the BladeEngine, and I've tried to use it in my routes.php
file:
Blade::extend(function ($value) {
$pattern = Blade::createMatcher('continue');
return preg_replace($pattern, '$1<?php continue; ?>$2', $value);
});
One of my views:
@if (isset($meta['foo']) && !$meta['bar'])
@continue
@else
<li>{{$meta['pseudo']}}</li>
@endif
But the rendered HTML page shows me @continue
.
Any idea of how make it work?
Blade::extend
command? – Dennis Braga Feb 3 '14 at 16:52route.php
– Fractaliste Feb 3 '14 at 19:48