At the moment I am trying to pass a value of a variable that is $images from my EntryController to the view that allows me to view a landing page that shows the images currently stored in the database
Undefined variable: images
Here is part of the entry blade file (landing.blade.php):
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Gallery List</div>
<div class="panel-body">
<a class="btn btn-info" href="/login">Login</a>
<a class="btn btn-primary" href="/register">Register</a>
<a class="btn btn-primary" href="/panelscreen">Panel</a>
</div>
</div>
</div>
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
<div class="row">
<div class='list-group gallery'>
@if($images->count())
@foreach($images as $image)
<div class='col-sm-4 col-xs-6 col-md-3 col-lg-3'>
<a class="thumbnail fancybox" rel="ligthbox" href="/public/{{ $image->image }}">
<img class="img-responsive" alt="" src="/public/{{ $image->image }}" />
<div class='text-center'>
<small class='text-muted'>{{ $image->title }}</small>
<small class='text-muted'>{{ $image->description }}</small>
</div>
</a>
</div>
@endforeach
@endif
</div>
</div>
</div>
</div>
@endsection
Here is the section of the EntryController.php file:
public function index()
{
$images = Entries::get();
return view('landing', compact('images'));
}
I can't understand why this error is appearing as I have referenced the variable $images in the index function.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community