Optimize query with eager loading
This commit is contained in:
@@ -23,7 +23,7 @@ class LatestPilots extends Widget
|
||||
|
||||
return view('widgets.latest_pilots', [
|
||||
'config' => $this->config,
|
||||
'users' => $userRepo->recent($this->config['count']),
|
||||
'users' => $userRepo->with(['airline'])->recent($this->config['count']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ class LatestPireps extends Widget
|
||||
$pirepRepo = app(PirepRepository::class);
|
||||
|
||||
$pireps = $pirepRepo
|
||||
->with(['airline', 'aircraft'])
|
||||
->whereNotInOrder('state', [
|
||||
PirepState::CANCELLED,
|
||||
PirepState::DRAFT,
|
||||
|
||||
Reference in New Issue
Block a user