mardi 25 octobre 2016

Eloquent query search in array

If i have a db column called 'search_terms' with contains an array like ["test","one","one two"].

I am trying to match search terms, so far i have:

Image::where( 'search_terms', 'like', "%{$term}%" )->get();

But looking for a way to to match exactly one of the terms in the array, so the term "one" would only match 1 result and not 2. Any ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire