I have a query that work fine but does not work pagination how to convert into eloquent to apply pagination
$projects=DB::select("select * from projects INNER JOIN(select DISTINCT * from (SELECT project_id FROM district_group_project_users where user_id='$id' UNION ALL select id from projects where created_by='$id') as sub ) as sub on sub.project_id=projects.id;");
OR is there any other option to add pagination on the following query? thanks