我想以雄辩的方式做到这一点。
select * from `documents` where (`id` in (select `related_id` from
`common_data` where `meta_key` = 'meta_key_name' and `meta_value` =
'1') or `created_by` = '1')
感谢您的回答。
答案 0 :(得分:1)
试试吧
$data = Document::where(function($query){
$query->whereRaw(" id in (select `related_id` from `common_data` where `meta_key` = 'meta_key_name' and `meta_value` ='1')")
->orWhere('created_by',1);
})->get();