teepluss / laravel-theme

Theme and asset managing for laravel
MIT License
545 stars 131 forks source link

laravel 5.3 make breadcrumb can't use @foreach #136

Open gandhyonly opened 7 years ago

gandhyonly commented 7 years ago

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

scottlaurent commented 7 years ago

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

monitork commented 7 years ago

@scottlaurent Thanks you so much!