added filter in seachcourse page
Cette révision appartient à :
Parent
8a9f89d974
révision
57192c2430
@ -25,13 +25,6 @@ public function index()
|
||||
return view('backend.course.courses.index', compact('course'));
|
||||
}
|
||||
|
||||
public function frontIndex()
|
||||
{
|
||||
$course = Course::get();
|
||||
$category = CourseCategory::get();
|
||||
return view('frontend.searchCourse', compact('course', 'category'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
|
||||
24
app/Http/Controllers/CoursePageController.php
Fichier normal
24
app/Http/Controllers/CoursePageController.php
Fichier normal
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Course;
|
||||
use App\Models\CourseCategory;
|
||||
|
||||
class CoursePageController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
|
||||
$category = CourseCategory::get();
|
||||
$selectedCategoryId = $request->input('category');
|
||||
|
||||
|
||||
$course = Course::when($selectedCategoryId, function ($query) use ($selectedCategoryId) {
|
||||
$query->where('course_category_id', $selectedCategoryId);
|
||||
})->get();
|
||||
|
||||
return view('frontend.searchCourse', compact('course', 'category', 'selectedCategoryId'));
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@ public function index()
|
||||
$category = CourseCategory::get();
|
||||
$popularCourses = Course::where('tag', 'popular')->get();
|
||||
|
||||
$designCategories = CourseCategory::whereIn('category_name', ['Graphics Desgin', 'Web Design', 'Video Editing', '2D Animation', '3D Animation'])->pluck('id')->toArray();
|
||||
$designCategories = CourseCategory::whereIn('category_name', ['Graphics Desgin', 'Web Design', 'Video Editing'])->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();
|
||||
@ -25,7 +25,7 @@ public function index()
|
||||
$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();
|
||||
$itCategories = CourseCategory::whereIn('category_name', ['Hardware', 'Network Technology', 'Software & Security', 'Operating System & Server', '2D Animation', '3D Animation'])->pluck('id')->toArray();
|
||||
$itCourses = Course::whereIn('course_category_id', $itCategories)->where('tag', 'popular')->get();
|
||||
|
||||
return view(
|
||||
|
||||
@ -62,11 +62,12 @@
|
||||
<div id="categoryCollapse" class="accordion-collapse collapse show"
|
||||
aria-labelledby="categoryAcc" data-bs-parent="#sidebarFilter">
|
||||
<div class="accordion-body">
|
||||
<form action="#">
|
||||
<form action="{{ route('searchCourse') }}" method="get">
|
||||
@csrf
|
||||
<div class="accordion-body__item">
|
||||
<div class="check-box">
|
||||
<input type="checkbox" class="checkbox-primary" />
|
||||
<label> All </label>
|
||||
<input type="checkbox" class="checkbox-primary" name="category" value="" {{
|
||||
!$selectedCategoryId ? 'checked' : '' }}> <label> All </label>
|
||||
</div>
|
||||
<p class="check-details">
|
||||
1,54,750
|
||||
@ -75,7 +76,9 @@
|
||||
@forelse($category as $cat)
|
||||
<div class="accordion-body__item">
|
||||
<div class="check-box">
|
||||
<input type="checkbox" class="checkbox-primary" />
|
||||
<input type="checkbox" class="checkbox-primary" name="category"
|
||||
value="{{ $cat->id }}" {{ $selectedCategoryId==$cat->id
|
||||
? 'checked' : '' }}>
|
||||
<label> {{$cat->category_name}} </label>
|
||||
</div>
|
||||
<p class="check-details">
|
||||
@ -84,6 +87,7 @@
|
||||
</div>
|
||||
@empty
|
||||
@endforelse
|
||||
<button type="submit" class="btn btn-primary">Apply Filter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@ -356,13 +360,13 @@ class="feather feather-chevron-right">
|
||||
</svg>
|
||||
</span>
|
||||
Filter
|
||||
</button>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Courses --}}
|
||||
<div class="row event-search-content">
|
||||
@forelse ($course as $c)
|
||||
@forelse ($course as $c)
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="contentCard contentCard--course">
|
||||
<div class="contentCard-top">
|
||||
@ -428,7 +432,7 @@ class="contentCard-user d-flex align-items-center">
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pagination-group mt-lg-5 mt-2">
|
||||
<a href="#" class="p_prev">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="9.414" height="16.828"
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
use App\Http\Controllers\Backend\Communication\MessageController as message;
|
||||
use App\Http\Controllers\CartController;
|
||||
use App\Http\Controllers\HomeController;
|
||||
use App\Http\Controllers\CoursePageController;
|
||||
use App\Http\Controllers\CheckoutController as checkout;
|
||||
use App\Http\Controllers\CouponController as coupon;
|
||||
use App\Http\Controllers\WatchCourseController as watchCourse;
|
||||
@ -96,7 +97,7 @@
|
||||
// frontend pages
|
||||
Route::get('home', [HomeController::class, 'index'])->name('home');
|
||||
Route::get('/', [HomeController::class, 'index'])->name('home');
|
||||
Route::get('searchCourse', [course::class, 'frontIndex'])->name('searchCourse');
|
||||
Route::get('searchCourse', [CoursePageController::class, 'index'])->name('searchCourse');
|
||||
Route::get('courseDetails/{id}', [course::class, 'frontShow'])->name('courseDetails');
|
||||
Route::get('watchCourse/{id}', [watchCourse::class, 'watchCourse'])->name('watchCourse');
|
||||
Route::get('instructorProfile/{id}', [instructor::class, 'frontShow'])->name('instructorProfile');
|
||||
|
||||
Chargement…
Référencer dans un nouveau ticket
Block a user