{{ __('10,000+ unique online courses') }}
{{ __('Our Most Popular Courses') }}
@php
$allCoursesIds = json_decode(
$featuredCourse?->all_category_ids ? $featuredCourse->all_category_ids : '[]',
);
$allCourses = App\Models\Course::with('category.translation', 'instructor:id,name')
->whereIn('id', $allCoursesIds)
->withCount([
'reviews as avg_rating' => function ($query) {
$query->select(DB::raw('coalesce(avg(rating), 0)'));
},
])
->withCount([
'lessons' => function ($query) {
$query->where('status', 'active');
},
])
->withCount('enrollments')
->get();
@endphp
-
@if ($featuredCourse?->category_one_status == 1)
-
@php
$categoryOne = Modules\Course\app\Models\CourseCategory::with(['translation'])
->where('id', $featuredCourse->category_one)
->first();
$categoryOneIds = json_decode($featuredCourse->category_one_ids);
$categoryOneCourses = App\Models\Course::with(
'category.translation',
'instructor:id,name',
)
->whereIn('id', $categoryOneIds)
->withCount([
'reviews as avg_rating' => function ($query) {
$query->select(DB::raw('coalesce(avg(rating), 0)'));
},
])
->withCount('enrollments')
->get();
@endphp
@endif
@if ($featuredCourse?->category_two_status == 1)
-
@php
$categoryTwo = Modules\Course\app\Models\CourseCategory::with(['translation'])
->where('id', $featuredCourse->category_two)
->first();
$categoryTwoIds = json_decode($featuredCourse->category_two_ids);
$categoryTwoCourses = App\Models\Course::with(
'category.translation',
'instructor:id,name',
)
->whereIn('id', $categoryTwoIds)
->withCount([
'reviews as avg_rating' => function ($query) {
$query->select(DB::raw('coalesce(avg(rating), 0)'));
},
])
->withCount('enrollments')
->get();
@endphp
-
@endif
@if ($featuredCourse?->category_three_status == 1)
-
@php
$categoryThree = Modules\Course\app\Models\CourseCategory::with(['translation'])
->where('id', $featuredCourse->category_three)
->first();
$categoryThreeIds = json_decode($featuredCourse->category_three_ids);
$categoryThreeCourses = App\Models\Course::with(
'category.translation',
'instructor:id,name',
)
->whereIn('id', $categoryThreeIds)
->withCount([
'reviews as avg_rating' => function ($query) {
$query->select(DB::raw('coalesce(avg(rating), 0)'));
},
])
->withCount('enrollments')
->get();
@endphp
-
@endif
@if ($featuredCourse?->category_four_status == 1)
-
@php
$categoryFour = Modules\Course\app\Models\CourseCategory::with(['translation'])
->where('id', $featuredCourse->category_four)
->first();
$categoryFourIds = json_decode($featuredCourse->category_four_ids);
$categoryFourCourses = App\Models\Course::with(
'category.translation',
'instructor:id,name',
)
->whereIn('id', $categoryFourIds)
->withCount([
'reviews as avg_rating' => function ($query) {
$query->select(DB::raw('coalesce(avg(rating), 0)'));
},
])
->withCount('enrollments')
->get();
@endphp
-
@endif
@if ($featuredCourse?->category_five_status == 1)
-
@php
$categoryFive = Modules\Course\app\Models\CourseCategory::with(['translation'])
->where('id', $featuredCourse->category_five)
->first();
$categoryFiveIds = json_decode($featuredCourse->category_five_ids);
$categoryFiveCourses = App\Models\Course::with(
'category.translation',
'instructor:id,name',
)
->whereIn('id', $categoryFiveIds)
->withCount([
'reviews as avg_rating' => function ($query) {
$query->select(DB::raw('coalesce(avg(rating), 0)'));
},
])
->withCount('enrollments')
->get();
@endphp
@endif