You can use spaces in the search as well as %
$term = 'tesco';
$model->where('field', 'like' , "% $term %")->get()`
Now matches whole word only?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to query a record where need to match word from beginning until a space?
For example, i have entered full keyword "tesco" then in my database consist of "tesco store". I would like to return this result.
If keyword "tes" entered, i will not show any record even there's partial string match with it.
I cannot use LIKE % % for it. Any method can achieve it?
Please or to participate in this conversation.