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