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

Posted 2 months ago by MartinZeltin

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

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.