You are creating an array of your search terms using "Explode":
$searchTerms = explode(' ', $q);
then using the variable as a string:
$patients = DB::table('patients')->where('first_name', 'LIKE', '%'. $searchTerms .'%');
You can remove:
$searchTerms = explode(' ', $q);
And change your query to:
$patients = DB::table('patients')->where('first_name', 'LIKE', '%'. $q .'%');
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community