So you would like a list of PIREPS for each hub, but is this filtered on the PIREP's dep/arr airport or the PIREP user's home airport? So in other words for each hub a list of PIREPS to/from that airport or a list of PIREPS from users from that hub? I'll assume the latter based on your example.
Not sure where you want to display it, but I would recommend a HUBS page (if that's what you are going for):
public function METHOD($icao) {
$pireps = $this->pirepRepo
->with('user')
->whereHas('user', function ($query) use($icao) {
return $query->where('home_airport_id', '=', $icao);
})
->paginate();
...
or if you wanted the first option
public function METHOD($icao) {
$where = ['dpt_airport_id' => $icao];
$orWhere = ['arr_airport_id' => $icao];
$pireps = $this->pirepRepo->scopeQuery(function($query) use ($where, $orWhere) {
return $query->where($where)->orWhere($orWhere)->orderBy('created_at', 'desc');
});
$pireps->paginate();
...
I think there's a whereOrder() method somewhere but not sure if it applies to this case.