1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Reduce extra queries

This commit is contained in:
Hillel Coren 2016-09-01 20:02:37 +03:00
parent 27ee5edd8a
commit 8696acf4d3
3 changed files with 4 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class QueryLogging
$queries = DB::getQueryLog();
$count = count($queries);
Log::info($request->method() . ' - ' . $request->url() . ": $count queries");
//Log::info($queries);
}
}

View File

@ -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);

View File

@ -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();
}