Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

martinszeltins's avatar

How could I make this query using Eloquent without using raw?

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
0 likes
2 replies

Please or to participate in this conversation.