laravel-theme icon indicating copy to clipboard operation
laravel-theme copied to clipboard

laravel 5.3 make breadcrumb can't use @foreach

Open gandhyonly opened this issue 8 years ago • 2 comments

this is an error example when using @foreach on breadcrumb->setTemplate('') : ErrorException in Breadcrumb.php(128) : eval()'d code line 3: Undefined variable: __env

I think it's because there's new variable $__env on loop and eval cant convert it to normal php?

when I echo $parsed before eval(),it return this: addLoop($__currentLoopData); foreach($__currentLoopData as $crumb): $__env->incrementLoopIndices(); $loop = $__env->getFirstLoop(); ?> popLoop(); $loop = $__env->getFirstLoop(); ?>

when I use @for I can use it normally

gandhyonly avatar Dec 18 '16 14:12 gandhyonly

@for didn't work for me. I would up changing: @foreach (...) ... @endforeach
to <?php foreach(...) { ?> ... <?php } ?> and that fixed it.

scottlaurent avatar Dec 30 '16 00:12 scottlaurent

@scottlaurent Thanks you so much!

monitork avatar Jan 06 '17 09:01 monitork