public function project_search(Request $request)
 {
     $this->setMetadata('Tìm kiếm dự án');
     $limit = Config::findByKey('rows_per_page_project')->first()->value;
     $project_type_id = $request->input('project_type');
     $province_id = $request->input('province');
     $district_id = $request->input('district');
     $ward_id = $request->input('ward');
     $street_id = $request->input('street');
     $searchDescription = "";
     $project_type = null;
     $province = null;
     $district = null;
     $ward = null;
     $street = null;
     $query = Project::query();
     try {
         if (isset($project_type_id) && $project_type_id != "") {
             $query->where('project_type_id', $project_type_id);
             $project_type = Project_type::findOrFail($project_type_id);
             $searchDescription .= $project_type->name;
         }
         if (isset($province_id) && $province_id != "") {
             $query->where('province_id', $province_id);
             $province = Province::findOrFail($province_id);
             $searchDescription .= ", " . $province->name;
         }
         if (isset($district_id) && $district_id != "") {
             $query->where('district_id', $district_id);
             $district = District::findOrFail($district_id);
             $searchDescription .= ", " . $district->name;
         }
         if (isset($ward_id) && $ward_id != "") {
             $query->where('ward_id', $ward_id);
             $ward = Ward::findOrFail($ward_id);
             $searchDescription .= ", " . $ward->name;
         }
         if (isset($street_id) && $street_id != "") {
             $query->where('street_id', $street_id);
             $street = Street::findOrFail($street_id);
             $searchDescription .= ", " . $street->name;
         }
     } catch (Exception $e) {
     }
     $projects = $query->paginate($limit);
     $projectCategory = new ProjectCategory();
     $projectsSpecial = $projectCategory->getProjectsByCategoryKey('du-an-noi-bat', 5);
     $hcmProvince = Province::findByKey('ho-chi-minh')->first();
     // dd($hcmProvince->id);
     $districtProject = District::where('province_id', '=', $hcmProvince->id)->where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->get();
     return view('frontend.sites1.project_search', ['projects' => $projects, 'projectsSpecial' => $projectsSpecial, 'districtProject' => $districtProject, 'searchDescription' => $searchDescription]);
 }
 /**
  * List Priject by Project-type || Province || District || Ward || Street ajax.
  */
 public function filterProject(Request $request)
 {
     $project_type_id = $request->project_type_id;
     $province_id = $request->province_id;
     $district_id = $request->district_id;
     $ward_id = $request->ward_id;
     $street_id = $request->street_id;
     $query = Project::query();
     $query->where('active', 1);
     if (!is_null($project_type_id) && $project_type_id != "") {
         $query->where('project_type_id', $project_type_id);
     }
     if (!is_null($province_id) && $province_id != "") {
         $query->where('province_id', $province_id);
     }
     if (!is_null($district_id) && $district_id != "") {
         $query->where('district_id', $district_id);
     }
     if (!is_null($ward_id) && $ward_id != "") {
         $query->where('ward_id', $ward_id);
     }
     if (!is_null($street_id) && $street_id != "") {
         $query->where('street_id', $street_id);
     }
     $projects = $query->orderBy('priority')->orderBy('created_at', 'desc')->take(20)->get();
     return $projects->toArray();
 }