I Try to build Advanced Search by Name and/or Category and/or Location and/or Month but i have issues i can't fix it, this the controller;

```
$searchName = $advancedSearchData['search_name'];
$searchCategory = $advancedSearchData['search_category'];
$searchLocation = $advancedSearchData['search_location'];

        if(!empty($searchName)) {
            $allCourses = Courses::where('course_name', 'like', '%'.$searchName.'%') -> get();
        }

        if($searchCategory !== 0) {
            $allCourses = Courses::where('course_name', 'like', '%'.$searchName.'%') -> where(['category_id' => $searchLocation]) -> get();
        }

        if($coursesLocation !== 0) {
            $allCourses = Courses::where('course_name', 'like', '%'.$searchName.'%') -> where(['location' => $searchLocation]) -> get();
        }

return view('layouts.public_layouts.courses.courses_search') -> with(compact('allCourses'));

```