nicolaslopezj / searchable

A php trait to search laravel models
MIT License
2.01k stars 291 forks source link

Search with array data #109

Open cbiong opened 8 years ago

cbiong commented 8 years ago

i have this column called colors inside users table with example data pink,white,red,violet

all of my column inside users table like (name, section, age) are searchable except for the data inside colors column

here is what i have inside my controller

User::search($request->input('search-key'), $fulltext = false)->get();

example data from db name: john doe age: 7 section: c1 colors: pink,white,red,violet

markwalet commented 7 years ago

This would work with the LIKE comparison. If you want exact matches I suggest you normalize your database :)