1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Add client to recurring invoice transformer

This commit is contained in:
David Bomba 2022-04-08 08:09:20 +10:00
parent 6fb3f5a45d
commit d3a9fb9dd7

View File

@ -13,11 +13,13 @@ namespace App\Transformers;
use App\Models\Activity;
use App\Models\Backup;
use App\Models\Client;
use App\Models\Document;
use App\Models\Invoice;
use App\Models\RecurringInvoice;
use App\Models\RecurringInvoiceInvitation;
use App\Transformers\ActivityTransformer;
use App\Transformers\ClientTransformer;
use App\Transformers\InvoiceHistoryTransformer;
use App\Utils\Traits\MakesHash;
@ -32,6 +34,7 @@ class RecurringInvoiceTransformer extends EntityTransformer
protected $availableIncludes = [
'activities',
'client',
];
public function includeHistory(RecurringInvoice $invoice)
@ -62,6 +65,13 @@ class RecurringInvoiceTransformer extends EntityTransformer
return $this->includeCollection($invoice->documents, $transformer, Document::class);
}
public function includeClient(RecurringInvoice $invoice)
{
$transformer = new ClientTransformer($this->serializer);
return $this->includeItem($invoice->client, $transformer, Client::class);
}
public function transform(RecurringInvoice $invoice)
{