|
@@ -16,6 +16,8 @@ class Blade {
|
|
|
'structure_openings',
|
|
|
'structure_closings',
|
|
|
'else',
|
|
|
+ 'unless',
|
|
|
+ 'endunless',
|
|
|
'includes',
|
|
|
'render_each',
|
|
|
'render',
|
|
@@ -254,6 +256,30 @@ class Blade {
|
|
|
return preg_replace('/(\s*)@(else)(\s*)/', '$1<?php $2: ?>$3', $value);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Rewrites Blade "unless" statements into valid PHP.
|
|
|
+ *
|
|
|
+ * @param string $value
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected static function compile_unless($value)
|
|
|
+ {
|
|
|
+ $pattern = '/(\s*)@unless(\s*\(.*\))/';
|
|
|
+
|
|
|
+ return preg_replace($pattern, '$1<?php if( ! ($2)): ?>', $value);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Rewrites Blade "unless" endings into valid PHP.
|
|
|
+ *
|
|
|
+ * @param string $value
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected static function compile_endunless($value)
|
|
|
+ {
|
|
|
+ return str_replace('@endunless', '<?php endif; ?>', $value);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Rewrites Blade @include statements into valid PHP.
|
|
|
*
|