如何将 mysql 转换为 laravel 查询生成器

How to convert mysql to laravel query builder

大家好,我在 mysql 中有这个原始查询,我需要转换为 laravel 5.4 查询生成器

select * from pages where (phase_id, type) in (select max(phase_id),type from pages where phase_id<=2 and actived=1 group by type) and actived=1

我不知道如何在查询生成器中转换 clausule with 2 colum

有什么想法吗?

谢谢大家

$results = DB::select(
    select * from pages where (phase_id, type) 
    in (
        select max(phase_id), type 
        from pages 
        where phase_id <= 2 
        and actived = 1 
        group by type
    ) 
    and actived = 1
);