Answer the question
In order to leave comments, you need to log in
Laravel whereExists table name?
Post::whereExists(function($query) use() {
$query->select('*')->from('entity_tag')->where('entity_tag.entity_id', 'posts.entity_id'));
});
SELECT * FROM pr_posts WHERE EXISTS(
SELECT * FROM pr_entity_tag WHERE pr_entity_tag.entity_id = posts.entity_id
)
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question