Support the ongoing development of Laravel.io →
Database Eloquent Forms
Last updated 2 years ago.
0

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 .'%');
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ubilli ubilli Joined 10 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.