0

How can I go about producing a query that will allow me to search my table to find any entries where the data field ends with the given value, like the following SQL would allow:

SELECT * FROM table
WHERE 'value' LIKE CONCAT('%', data)

Currently I can do the normal 'LIKE' syntax as follows:

return $query->where('data', 'LIKE', "%$value");

But it doesn't seem to support the reverse, where I am looking for the value in the data column ending with the $value input.

While I could use a raw query, I wanted to know if this was possible to do within Laravel's query builders so that I can ensure proper escaping, etc.

(Sorry for previous lack of info, pressed enter before I was finished and it posted question immediately)

Blam
  • 2,888
  • 3
  • 25
  • 39

0 Answers0