feat: Add functions to retrieve previous and upcoming events; update events template to display dynamic event data
This commit is contained in:
@@ -4,6 +4,7 @@ use Modules\CCMS\Models\Blog;
|
|||||||
use Modules\CCMS\Models\Category;
|
use Modules\CCMS\Models\Category;
|
||||||
use Modules\CCMS\Models\Counter;
|
use Modules\CCMS\Models\Counter;
|
||||||
use Modules\CCMS\Models\Country;
|
use Modules\CCMS\Models\Country;
|
||||||
|
use Modules\CCMS\Models\Event;
|
||||||
use Modules\CCMS\Models\Faq;
|
use Modules\CCMS\Models\Faq;
|
||||||
use Modules\CCMS\Models\FaqCategory;
|
use Modules\CCMS\Models\FaqCategory;
|
||||||
use Modules\CCMS\Models\Gallery;
|
use Modules\CCMS\Models\Gallery;
|
||||||
@@ -150,6 +151,32 @@ function getServices($limit = null, $order = 'desc')
|
|||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function previousEvents($limit = null, $order = 'desc')
|
||||||
|
{
|
||||||
|
return Event::query()
|
||||||
|
->where('status', 1)
|
||||||
|
->where('parent_id', null)
|
||||||
|
->where('start_date', '<=', now())
|
||||||
|
->orderBy('order', $order)
|
||||||
|
->when($limit, function ($query) use ($limit) {
|
||||||
|
$query->limit($limit);
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
function upcomingEvents($limit = null, $order = 'desc')
|
||||||
|
{
|
||||||
|
return Event::query()
|
||||||
|
->where('status', 1)
|
||||||
|
->where('parent_id', null)
|
||||||
|
->where('start_date', '>=', now())
|
||||||
|
->orderBy('order', $order)
|
||||||
|
->when($limit, function ($query) use ($limit) {
|
||||||
|
$query->limit($limit);
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
function getInstitutions($limit = null, $order = 'desc')
|
function getInstitutions($limit = null, $order = 'desc')
|
||||||
{
|
{
|
||||||
return Institution::query()
|
return Institution::query()
|
||||||
|
@@ -52,6 +52,8 @@ class WebsiteController extends Controller
|
|||||||
$data['successGalleries'] = getGalleriesByCategory(limit: 3, order: 'asc', category: 'voice-of-success');
|
$data['successGalleries'] = getGalleriesByCategory(limit: 3, order: 'asc', category: 'voice-of-success');
|
||||||
$data['destinations'] = getDestinations(limit: null, order: 'asc');
|
$data['destinations'] = getDestinations(limit: null, order: 'asc');
|
||||||
$data['services'] = getServices(limit: null, order: 'asc');
|
$data['services'] = getServices(limit: null, order: 'asc');
|
||||||
|
$data['previousEvents'] = previousEvents(limit: null, order: 'asc');
|
||||||
|
$data['upcomingEvents'] = upcomingEvents(limit: null, order: 'asc');
|
||||||
$data['classes'] = getClasses(limit: null, order: 'asc');
|
$data['classes'] = getClasses(limit: null, order: 'asc');
|
||||||
$data['institutions'] = getInstitutions(limit: null, order: 'asc');
|
$data['institutions'] = getInstitutions(limit: null, order: 'asc');
|
||||||
$data['faqs'] = getFAQs(limit: null, order: 'desc');
|
$data['faqs'] = getFAQs(limit: null, order: 'desc');
|
||||||
|
@@ -22,101 +22,25 @@
|
|||||||
|
|
||||||
<div class="swiper swiper-events mt-40 mb-40">
|
<div class="swiper swiper-events mt-40 mb-40">
|
||||||
<div class="swiper-wrapper">
|
<div class="swiper-wrapper">
|
||||||
<a href="" class="swiper-slide">
|
@foreach ($upcomingEvents as $event)
|
||||||
<div class="event-block relative w-full">
|
<a href="" class="swiper-slide">
|
||||||
<div class="w-full rounded-30">
|
<div class="event-block relative w-full">
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
<div class="w-full rounded-30">
|
||||||
</div>
|
<img src="{{ asset($event->image) }}" alt="">
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
<div>
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
<h4 class="text-16 text-ter">Start</h4>
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
<h4 class="text-18 font-bold text-black">{{ $event->start_date }}</h4>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 class="text-16 text-black">{{ $event->title }}</h3>
|
||||||
|
<p class="text-14 p-0 m-0 text-grey">{{ $event->short_description }} </p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a>
|
||||||
|
@endforeach
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
<!-- <div class="swiper-pagination"></div> -->
|
<!-- <div class="swiper-pagination"></div> -->
|
||||||
@@ -137,102 +61,27 @@
|
|||||||
|
|
||||||
<div class="swiper swiper-events mt-40">
|
<div class="swiper swiper-events mt-40">
|
||||||
<div class="swiper-wrapper">
|
<div class="swiper-wrapper">
|
||||||
<a href="" class="swiper-slide">
|
@foreach ($upcomingEvents as $event)
|
||||||
<div class="event-block relative w-full">
|
<a href="" class="swiper-slide">
|
||||||
<div class="w-full rounded-30">
|
<div class="event-block relative w-full">
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
<div class="w-full rounded-30">
|
||||||
</div>
|
<img src="{{ asset($event->image) }}" alt="">
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
<div>
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
<h4 class="text-16 text-ter">Start</h4>
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
<h4 class="text-18 font-bold text-black">{{ $event->start_date }}</h4>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 class="text-16 text-black">{{ $event->title }}</h3>
|
||||||
|
<p class="text-14 p-0 m-0 text-grey">{{ $event->short_description }} </p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
<a href="" class="swiper-slide">
|
|
||||||
<div class="event-block relative w-full">
|
|
||||||
<div class="w-full rounded-30">
|
|
||||||
<img src="{{ asset('raffles/assets/images/general/event1.jfif') }}" alt="">
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-20 py-20 px-20 bg-white rounded-30">
|
|
||||||
<div>
|
|
||||||
<h4 class="text-16 text-ter">Apr</h4>
|
|
||||||
<h4 class="text-18 font-bold text-black">14</h4>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 class="text-16 text-black">Free ilets Class: Raffles Educare Associates</h3>
|
|
||||||
<p class="text-14 p-0 m-0 text-grey">Join the free ilets Classes </p>
|
|
||||||
<p class="text-14 text-grey">Starting from 5 pm - 7 pm </p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
<!-- <div class="swiper-pagination"></div> -->
|
<!-- <div class="swiper-pagination"></div> -->
|
||||||
@@ -280,12 +129,6 @@
|
|||||||
<div class="swiper-button-next"></div>
|
<div class="swiper-button-next"></div>
|
||||||
<div class="swiper-button-prev"></div>
|
<div class="swiper-button-prev"></div>
|
||||||
</div>
|
</div>
|
||||||
{{-- <div class="flex justify-center items-center ">
|
|
||||||
<button class="text-center bg-white text-ter rounded-30 text-14">Load More</button>
|
|
||||||
|
|
||||||
|
|
||||||
</div> --}}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
Reference in New Issue
Block a user