added course count by category in home page
Cette révision appartient à :
Parent
6ba10c9bba
révision
2dcd386557
@ -17,7 +17,7 @@ public function up(): void
|
||||
$table->string('title_bn')->nullable();
|
||||
$table->text('description_en')->nullable();
|
||||
$table->text('description_bn')->nullable();
|
||||
$table->unsignedBigInteger('category_id')->index();
|
||||
$table->unsignedBigInteger('course_category_id')->index();
|
||||
$table->unsignedBigInteger('instructor_id')->index();
|
||||
$table->enum('type', ['free', 'paid', 'subscription'])->default('paid');
|
||||
$table->decimal('price', 10, 2)->default(0.00)->nullable();
|
||||
@ -40,7 +40,7 @@ public function up(): void
|
||||
|
||||
// Foreign key constraints
|
||||
$table->foreign('instructor_id')->references('id')->on('instructors')->onDelete('cascade');
|
||||
$table->foreign('category_id')->references('id')->on('course_categories')->onDelete('cascade');
|
||||
$table->foreign('course_category_id')->references('id')->on('course_categories')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -51,6 +51,10 @@ class="img-fluid" />
|
||||
<div class="browse-categories__wrapper position-relative">
|
||||
<div class="categories--box">
|
||||
@forelse ($category as $cat)
|
||||
@php
|
||||
// Fetch the count of courses for each category
|
||||
$courseCount = $cat->course()->count();
|
||||
@endphp
|
||||
<div class="browse-categories-item default-item-one mb-2">
|
||||
<div class="browse-categories-item-icon">
|
||||
<div class="categories-one default-categories">
|
||||
@ -59,7 +63,7 @@ class="img-fluid" />
|
||||
</div>
|
||||
<div class="browse-categories-item-text">
|
||||
<h6 class="font-title--card"><a href="#">{{$cat->category_name}}</a></h6>
|
||||
<p>587 Courses</p>
|
||||
<p>{{ $courseCount }} Courses</p>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user