lundi 17 août 2015

By using laravel 5.1 error that appears in view when trying display image from array by foreach

I'm trying to display image from array defined inside controller through foreach loop defined inside view at Laravel 5.1 but i have this error that's appearing because the cache

Error depend on Log in Laravel 5.1

local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'parse error' in /Users/alaasabra/libapp/storage/framework/views/3bd627f3970d38e63304903ba6823083:9

my controller :

   $sections = ['art'=>'art.jpg','mechanic'=>'mechanic.jpg','history'=>'history.jpg',
  'programming'=>'programming.jpg','comic'=>'comic.jpg','civil'=>'civil.jpg'];
    return view('libraryViewsContainer.library')->withDate($date)->withTime($time)->withSections($sections);

my view :

 <div class="container" style="opacity: 0.9">
    <div class="row">


        @foreach($sections as $k=>$v)
        <div class="col-md-3">
            <div class="thumbnail">
                <img src="{{ asset('images/{{$v}}')}}" />
                <h1><a class="btn btn-primary">{{$k}}</a></h1>
            </div>
        </div>
        @endforeach

    </div>


</div>

the error at display image because the view built by cache at this path :

Users/alaasabra/libapp/storage/framework/views

displayed like this :

<?php $__env->startSection('content'); ?>
<div class="container" style="opacity: 0.9">
    <div class="row">


        <?php foreach($sections as $k=>$v): ?>
        <div class="col-md-3">
            <div class="thumbnail">
                <img src="<?php echo e(asset('images/{{$v); ?>')}}" />
                <h1><a class="btn btn-primary"><?php echo e($k); ?></a></h1>
            </div>
        </div>
        <?php endforeach; ?>

    </div>


</div>

so what is the problem here at line 9 at the last file that built automatically by cache

Aucun commentaire:

Enregistrer un commentaire