Fix query for attachment icon.

This commit is contained in:
James Cole 2020-02-23 07:38:23 +01:00
parent ee7731b1a1
commit 8c8a2a1596
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -961,7 +961,12 @@ class GroupCollector implements GroupCollectorInterface
// join some extra tables:
$this->hasJoinedAttTables = true;
$this->query->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id')
->where('attachments.attachable_type', TransactionJournal::class);
->where(
static function (EloquentBuilder $q1) {
$q1->where('attachments.attachable_type', TransactionJournal::class);
$q1->orWhereNull('attachments.attachable_type');
}
);
}
}