Skip to content

Instantly share code, notes, and snippets.

@evercode1
Last active March 26, 2019 23:54
Show Gist options
  • Save evercode1/1139bb43fede57700502bc12b1aacd09 to your computer and use it in GitHub Desktop.
Save evercode1/1139bb43fede57700502bc12b1aacd09 to your computer and use it in GitHub Desktop.
Chapter 10 Revised slider.blade.php
<div>
<div>
@if ($notEnoughImages)
Not enough images in slider. Populate images or remove slider include from pages.index.
@else
<div id="carousel-marketing-images" class="carousel slide" data-ride="carousel" data-interval="false">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-marketing-images" data-slide-to="0" class="active"></li>
@foreach (range(1, $count) as $number)
<li data-target="#carousel-marketing-images" data-slide-to="{{ $number }}"></li>
@endforeach
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="{{ $featuredImage->showImage($featuredImage, $imagePath) }}"
alt="{{ $featuredImage->image_name }}">
<div class="carousel-caption">
<h1></h1>
</div>
</div>
@foreach ($activeImages as $image)
<div class="item">
<img src="{{ $image->showImage($image, $imagePath)}}"
alt="{{ $image->image_name }}">
<div class="carousel-caption">
<h1> </h1>
</div>
</div>
@endforeach
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-marketing-images" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-marketing-images" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
@endif
</div>
</div>
@guillermo7227
Copy link

guillermo7227 commented Mar 26, 2019

For this to work, the method notEnoughSliderImages() in ShowsImages trait needs to change.
The line return (!count($featuredImage) || !count($activeImages) >= 1) ? true : false; needs to be return (is_null($featuredImage) || !count($activeImages) >= 1) ? true : false;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment