Level 75
Setup a length aware paginator as needed: https://laracasts.com/discuss/channels/guides/length-aware-paginator
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How to apply pagination in different query results ?
->join('sectors', 'sectors.id','incidents.sector_id')
->join('incident_notes', 'incident_notes.incident_id','incidents.id')
->leftJoin('bdms', 'bdms.id','sectors.bdm_id')
->where('bdms.user_id',Auth::user()->id)
->whereIn('sectors.id',$inactiveSectorIncident)
->orderBy($field, $sort)
->limit($countSourceActiveNote)
->groupby('sectors.id')
->get();
$sourceInActiveNote = Sector::select('sectors.id', 'sectors.sector_type', 'sectors.name', 'sectors.created_at',DB::raw('IFNULL( sectors.deleted_at, "In-Active") as type'),DB::raw('MAX(sector_notes.updated_at) as activity_date'),DB::raw('IFNULL( sectors.deleted_at, "Source Note") as activity_type'),DB::raw('IFNULL( sectors.country, "UK") as country'))
->leftJoin('bdms', 'bdms.id','sectors.bdm_id')
->leftJoin('sector_notes', 'sector_notes.sector_id','sectors.id')
->whereIn('sectors.id',$inactiveSectorNote)
->where('bdms.user_id',Auth::user()->id)
->orderBy($field, $sort)
->limit($countSourceInActiveIncident)
->groupby('sectors.id')
->get();
$result = $sourceActiveIncident->merge($sourceActiveNote);```
//how to apply pagination on result array in laravel any idea
//like this
->skip(($page - 1) * $countSourceActiveIncident)
->limit($countSourceActiveIncident)
Please or to participate in this conversation.