Possible operators on Eloquent's "where" function

Submitted by msurguy - 10 years ago

When doing some sort of filtering in Eloquent, sometimes you need to use operators other than "=" and there is no easy way to know which operators you can use. This trick details the possible operators for you.

//Retrieving records matching a criteria:
$profitableShops = Shop::where('orders_cache','>','100')->get(); 
// where() takes 3 parameters, name of the column, operator and value to be compared against. 

// The operator can be one of the following: '=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'not like', 'between', 'ilike'