Using Eloquent ORM in Laravel to perform search of database using LIKE

Jonathan picture Jonathan · Nov 14, 2012 · Viewed 133k times · Source

I want to use Eloquent's active record building to build a search query, but it is going to be a LIKE search. I have found the User::find($term) or User::find(1), but this is not generating a like statement. I'm not looking for a direct answer, but if someone could at least give me a direction to look in that'd be great!

Answer

Joel Larson picture Joel Larson · Nov 14, 2012

You're able to do database finds using LIKE with this syntax:

Model::where('column', 'LIKE', '%value%')->get();