Level 24
Take a look at https://laravel.com/docs/queries#where-exists-clauses.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have this raw query and I would like to create it using Elequent. Is it possible to do it without using a raw query?
SELECT users.id, users.full_name
FROM users
WHERE
EXISTS (SELECT 1
FROM
user_phones
WHERE
user_phones.user_id = users.id AND
user_phones.phone LIKE '%12345678%'
)
ORDER BY
users.full_name
Take a look at https://laravel.com/docs/queries#where-exists-clauses.
Please or to participate in this conversation.