Merge pull request #5688 from turbo124/v5-develop

Add history as available include for recurring invoices
This commit is contained in:
David Bomba 2021-05-12 18:37:42 +10:00 committed by GitHub
commit 55e2f59681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -44,6 +44,9 @@ class SystemLogger implements ShouldQueue
public function handle() :void
{
if(!$this->client)
return;
$sl = [
'client_id' => $this->client->id,
'company_id' => $this->client->company->id,

View File

@ -12,11 +12,13 @@
namespace App\Transformers;
use App\Models\Activity;
use App\Models\Backup;
use App\Models\Document;
use App\Models\Invoice;
use App\Models\RecurringInvoice;
use App\Models\RecurringInvoiceInvitation;
use App\Transformers\ActivityTransformer;
use App\Transformers\InvoiceHistoryTransformer;
use App\Utils\Traits\MakesHash;
class RecurringInvoiceTransformer extends EntityTransformer
@ -32,7 +34,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
'invitations',
'documents',
'activities',
// 'payments',
'history',
// 'client',
];
@ -65,6 +67,14 @@ class RecurringInvoiceTransformer extends EntityTransformer
return $this->includeItem($invoice->client, $transformer, ENTITY_CLIENT);
}
*/
public function includeHistory(RecurringInvoice $invoice)
{
$transformer = new InvoiceHistoryTransformer($this->serializer);
return $this->includeCollection($invoice->history, $transformer, Backup::class);
}
public function includeActivities(RecurringInvoice $invoice)
{
$transformer = new ActivityTransformer($this->serializer);