Skip to content

Commit

Permalink
⚡ reduce query count on dashboard (#2612)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed May 27, 2024
1 parent 9fdc5a4 commit ef863d7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/Backend/User/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ public static function getPrivateDashboard(User $user): Paginator {
$followingIDs[] = $user->id;
return Status::with([
'event', 'likes', 'user.blockedByUsers', 'user.blockedUsers', 'checkin',
'mentions.mentioned',
'checkin.originStation', 'checkin.destinationStation',
'checkin.originStopover', 'checkin.destinationStopover',
'checkin.Trip.stopovers.station'
'checkin.trip.stopovers.station'
])
->join('train_checkins', 'train_checkins.status_id', '=', 'statuses.id')
->select('statuses.*')
Expand All @@ -41,9 +42,10 @@ public static function getPrivateDashboard(User $user): Paginator {
public static function getGlobalDashboard(User $user): Paginator {
return Status::with([
'event', 'likes', 'user.blockedByUsers', 'user.blockedUsers', 'checkin',
'mentions.mentioned',
'checkin.originStation', 'checkin.destinationStation',
'checkin.originStopover', 'checkin.destinationStopover',
'checkin.Trip.stopovers.station'
'checkin.trip.stopovers.station'
])
->join('train_checkins', 'train_checkins.status_id', '=', 'statuses.id')
->join('users', 'statuses.user_id', '=', 'users.id')
Expand Down

0 comments on commit ef863d7

Please sign in to comment.