diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index ae6a852..455bfde 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -15,7 +15,22 @@ public function index() $instructor = Instructor::get(); $category = CourseCategory::get(); $popularCourses = Course::where('tag', 'popular')->get(); - return view('frontend.home', compact('course', 'instructor', 'category', 'popularCourses')); - } + $designCategories = CourseCategory::whereIn('category_name', ['Graphics Desgin', 'Web Design', 'Video Editing', '2D Animation', '3D Animation'])->pluck('id')->toArray(); + $designCourses = Course::whereIn('course_category_id', $designCategories)->where('tag', 'popular')->get(); + + $developmentCategories = CourseCategory::whereIn('category_name', ['Web Development', 'Mobile Development', 'Game Development', 'Database Design & Development', 'Data Science'])->pluck('id')->toArray(); + $developmentCourses = Course::whereIn('course_category_id', $developmentCategories)->where('tag', 'popular')->get(); + + $businessCategories = CourseCategory::whereIn('category_name', ['Digital Marketing', 'Entrepreneurship'])->pluck('id')->toArray(); + $businessCourses = Course::whereIn('course_category_id', $businessCategories)->where('tag', 'popular')->get(); + + $itCategories = CourseCategory::whereIn('category_name', ['Hardware', 'Network Technology', 'Software & Security', 'Operating System & Server'])->pluck('id')->toArray(); + $itCourses = Course::whereIn('course_category_id', $itCategories)->where('tag', 'popular')->get(); + + return view( + 'frontend.home', + compact('course', 'instructor', 'category', 'popularCourses', 'designCourses', 'developmentCourses', 'businessCourses', 'itCourses') + ); + } } diff --git a/resources/views/frontend/home.blade.php b/resources/views/frontend/home.blade.php index eadccc0..354c28b 100644 --- a/resources/views/frontend/home.blade.php +++ b/resources/views/frontend/home.blade.php @@ -55,17 +55,18 @@ class="img-fluid" /> // Fetch the count of courses for each category $courseCount = $cat->course()->count(); @endphp -
-
-
- -
-
-
-
{{$cat->category_name}}
-

{{ $courseCount }} Courses

+
+
+
+
+
+
{{$cat->category_name}}
+

{{ $courseCount }} Courses

+
+
@empty @endforelse
@@ -81,7 +82,7 @@ class="img-fluid" /> class="img-fluid shape-01" /> shape
- + + {{-- Why You'll Learn With Eduguard --}}
@@ -887,74 +909,81 @@ class="img-fluid" />
@forelse ($instructor as $i) -
- -
-
- {{$i->name_en}} -
-

{{$i->designation}}

-
+
+ +
+
+ {{$i->name_en}} +
+

{{$i->designation}}

+
+
@empty @endforelse
@@ -981,31 +1010,34 @@ class="img-fluid shape01" />
@forelse ($course as $c) -
-
- images -
-
-
- {{$c->title_en}} -
-
-
-
- location -
- Chicago, Illinois +
+
+ images +
+
+
+ {{$c->title_en}} +
+
+
+
+ location
-
-
- calendar -
- 29th jan, 2020 + Chicago, Illinois +
+
+
+ calendar
+ 29th jan, 2020
+
@empty @endforelse