mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 00:11:35 +02:00
Reduce extra queries
This commit is contained in:
parent
27ee5edd8a
commit
8696acf4d3
@ -33,6 +33,7 @@ class QueryLogging
|
||||
$queries = DB::getQueryLog();
|
||||
$count = count($queries);
|
||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries");
|
||||
//Log::info($queries);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ class HistoryUtils
|
||||
];
|
||||
|
||||
$activities = Activity::scope()
|
||||
->with('client.contacts', 'invoice')
|
||||
->with(['client.contacts', 'invoice'])
|
||||
->whereIn('user_id', $userIds)
|
||||
->whereIn('activity_type_id', $activityTypes)
|
||||
->orderBy('id', 'asc')
|
||||
@ -46,6 +46,7 @@ class HistoryUtils
|
||||
$entity = $activity->client;
|
||||
} else {
|
||||
$entity = $activity->invoice;
|
||||
$entity->setRelation('client', $activity->client);
|
||||
}
|
||||
|
||||
static::trackViewed($entity);
|
||||
|
@ -114,7 +114,7 @@ class DashboardRepository
|
||||
}
|
||||
|
||||
return $activities->orderBy('activities.created_at', 'desc')
|
||||
->with('client.contacts', 'user', 'invoice', 'payment', 'credit', 'account')
|
||||
->with('client.contacts', 'user', 'invoice', 'payment', 'credit', 'account', 'task')
|
||||
->take(50)
|
||||
->get();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user