Skip to content

Commit

Permalink
add date in the countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sharbel93 committed Nov 11, 2019
1 parent 998a5e8 commit e16cc2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/Http/Controllers/ViewPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class ViewPageController extends Controller
//different view pages of the website
public function getIndex() {
// $events = Event::orderBy('id', 'desc')->take(3);
$counter = Event::orderBy('start', 'desc')->first();
$events = Event::orderBy('start', 'desc')->get()->take(2);
$upcoming = Event::orderBy('start', 'asc')->get()->take(5);
return view('pages.index')->withEvents($events)->withUpcoming($upcoming);
return view('pages.index')->withEvents($events)->withUpcoming($upcoming)->withCounter($counter);
}

public function getAbout() {
Expand Down
15 changes: 8 additions & 7 deletions resources/views/pages/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@
<div class="row ">
<div class="col-md-6 mb-3 element-animate">
<span class="section-heading">Upcoming Events</span>
<h2><a href="#">CrossOver Service 2019</a></h2>
<h2 class="text-capitalize"><a href="#">{{$counter->title}}</a></h2>
<div class="events-meta">
<span class="mr-2"><span
class="far fa-calendar-alt mr-2"></span>Monday 31st/12/2018 9:00 pm</span>
<span class="mr-2"><span class="fas fa-location-arrow mr-2"></span>House Of Grace Church,
Eldoret</span>
{{--<span class="mr-2"><span class="fas fa-user mr-2"></span>Pastor Luis Matthew</span>--}}
class="far fa-calendar-alt mr-2"></span>{{date('j F, Y', strtotime($counter->start))}} -
{{date('j F, Y', strtotime($counter->end))}}</span> <br>
<span class="mr-2"><span class="fas fa-location-arrow mr-2"></span>{{$counter->venue}},{{$counter->location}}
</span> <br>
<span class="mr-2"><span class="fas fa-user mr-2"></span>Guest:&nbsp;{{$counter->guest}}</span>
</div>
</div>
<div class="col-md-6 element-animate">
Expand Down Expand Up @@ -377,8 +378,8 @@ function setAnimation(_elem, _InOut) {
});
});
$('#date-countdown').countdown('2018/12/31', function (event) {
// add date for counter
$('#date-countdown').countdown('@json($counter->start)', function (event) {
var $this = $(this).html(event.strftime(''
+ '<span class="countdown-block"><span class="label">%w</span> weeks </span>'
+ '<span class="countdown-block"><span class="label">%d</span> days </span>'
Expand Down

0 comments on commit e16cc2a

Please sign in to comment.