|
@@ -390,22 +390,22 @@ class HomeController extends Controller
|
|
|
{
|
|
|
$term = $request->input('term') ? trim($request->input('term')) : '';
|
|
|
if (empty($term)) return '';
|
|
|
+ $term = strtolower($term);
|
|
|
$pharmacies = Facility::where('facility_type', 'Pharmacy')
|
|
|
->where(function ($q) use ($term) {
|
|
|
- $q->orWhere('name', 'ILIKE', '%' . $term . '%')
|
|
|
- ->orWhere('address_line1', 'ILIKE', '%' . $term . '%')
|
|
|
- ->orWhere('address_line2', 'ILIKE', '%' . $term . '%')
|
|
|
- ->orWhere('address_city', 'ILIKE', '%' . $term . '%')
|
|
|
- ->orWhere('address_state', 'ILIKE', '%' . $term . '%')
|
|
|
- ->orWhere('phone', 'ILIKE', '%' . $term . '%')
|
|
|
- ->orWhere('address_zip', 'ILIKE', '%' . $term . '%');
|
|
|
+ $q->orWhereRaw('LOWER(name::text) LIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(address_line1::text) LIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(address_line2::text) LIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(address_city::text) LIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(address_state::text) LIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(phone::text) LIKE ?', ['%' . $term . '%'])
|
|
|
+ ->orWhereRaw('LOWER(address_zip::text) LIKE ?', ['%' . $term . '%']);
|
|
|
})
|
|
|
->orderBy('name', 'asc')
|
|
|
->orderBy('address_line1', 'asc')
|
|
|
->orderBy('address_city', 'asc')
|
|
|
->orderBy('address_state', 'asc')
|
|
|
->get();
|
|
|
-
|
|
|
return view('app/pharmacy-suggest', compact('pharmacies'));
|
|
|
}
|
|
|
|