Perform an SQL Query With Eloquent Using the LIKE Operator

Laravel's Eloquent allows you to perform virtually any SQL query, but it can become confusing sometimes. I will try to go through most of the common queries in the future to help you better understand how Eloquent works and I'm going to start with the LIKE operator.

Fortunately it's pretty simple and very similar to all the other operators, but I know I was a bit confused about it when I started using Eloquent.

How to perform an Eloquent SQL Query with LIKE

Using the LIKE operator is very similar to most of the other operators, like =, <> or != and it looks like this:

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

Make sure to use double quotes for the value or you might get in trouble with some configurations.