I want to write this raw query using Eloquent. I have tried using ->whereRaw but it shows error due to special characters in it.
SELECT id,shipping_email FROM orders WHERE 1 AND `shipping_email` NOT REGEXP '^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$' AND id = '<>'
Help is appreciated... Thanks in advance.
I have got answer, I have tried these codes..
\Model\Order::query()
->select('id', 'shipping_email')
->whereRaw("`shipping_email` NOT REGEXP ?", ["^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,63}$"])
->get();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.