From 992a5f74ca5e86be8a9570d438d62bfe62b03ad3 Mon Sep 17 00:00:00 2001 From: Dayle Rees Date: Fri, 25 May 2012 20:34:13 +0100 Subject: [PATCH] fix for forelse only matching $vars Signed-off-by: Dayle Rees --- laravel/blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/blade.php b/laravel/blade.php index 5961a530..416848f9 100644 --- a/laravel/blade.php +++ b/laravel/blade.php @@ -213,12 +213,12 @@ protected static function compile_forelse($value) foreach ($matches[0] as $forelse) { - preg_match('/\$[^\s]*/', $forelse, $variable); + preg_match('/\s*\(\s*(\S*)\s/', $forelse, $variable); // Once we have extracted the variable being looped against, we can add // an if statement to the start of the loop that checks if the count // of the variable being looped against is greater than zero. - $if = " 0): ?>"; + $if = " 0): ?>"; $search = '/(\s*)@forelse(\s*\(.*\))/';