W
W
WebDev2016-08-26 16:32:09
Laravel
WebDev, 2016-08-26 16:32:09

Laravel whereExists table name?

Post::whereExists(function($query) use() {
    $query->select('*')->from('entity_tag')->where('entity_tag.entity_id', 'posts.entity_id'));
});

This is the code that returns
SELECT * FROM pr_posts WHERE EXISTS(
    SELECT * FROM pr_entity_tag WHERE pr_entity_tag.entity_id = posts.entity_id
)

Why doesn't it convert posts to table name?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-08-26
@kirill-93

Because no one promised that he would do it. The second argument is the comparison value, how does the framework know that you will pass the name of the table and column there? Such rare cases - by hand.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question