1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Improve eager loading

This commit is contained in:
David Bomba 2020-09-19 20:05:29 +10:00
parent aeeaa62d5e
commit 4b00d3a82a
2 changed files with 5 additions and 3 deletions

View File

@ -71,6 +71,7 @@ class BaseController extends Controller
'company.clients.gateway_tokens',
'company.clients.documents',
'company.products',
'company.products.documents',
'company.recurring_invoices',
'company.invoices.invitations.contact',
'company.invoices.invitations.company',
@ -92,6 +93,7 @@ class BaseController extends Controller
'company.tasks',
'company.projects',
'company.designs',
'company.documents',
'company.webhooks',
'company.tokens_hashed',
];
@ -202,7 +204,7 @@ class BaseController extends Controller
$query->with(
[
'company' => function ($query) use ($updated_at) {
$query->whereNotNull('updated_at');
$query->whereNotNull('updated_at')->with('documents');
},
'company.clients' => function ($query) use ($updated_at) {
$query->where('clients.updated_at', '>=', $updated_at)->with('contacts', 'gateway_tokens','documents');
@ -217,7 +219,7 @@ class BaseController extends Controller
$query->whereNotNull('updated_at');
},
'company.products' => function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at);
$query->where('updated_at', '>=', $updated_at)->with('documents');
},
'company.recurring_invoices'=> function ($query) use ($updated_at) {
$query->where('updated_at', '>=', $updated_at)->with('company');

View File

@ -56,7 +56,7 @@ class SendFailedEmails implements ShouldQueue
private function processEmails()
{
\Log::error('processing emails');
//\Log::error('processing emails');
//info("process emails");
//@todo check that the quota is available for the job