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

Merge pull request #7565 from beganovich/credit-client-relationship

Add `client` relationship to CreditTransformer
This commit is contained in:
David Bomba 2022-06-18 08:57:09 +10:00 committed by GitHub
commit 5b5167ae59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ use App\Models\CreditInvitation;
use App\Models\Document;
use App\Transformers\ActivityTransformer;
use App\Utils\Traits\MakesHash;
use League\Fractal\Resource\Item;
class CreditTransformer extends EntityTransformer
{
@ -30,6 +31,7 @@ class CreditTransformer extends EntityTransformer
protected $availableIncludes = [
'activities',
'client',
];
public function includeActivities(Credit $credit)
@ -53,28 +55,13 @@ class CreditTransformer extends EntityTransformer
return $this->includeCollection($credit->invitations, $transformer, CreditInvitation::class);
}
/*
public function includePayments(quote $credit)
{
$transformer = new PaymentTransformer($this->account, $this->serializer, $credit);
public function includeClient(Credit $credit): Item
{
$transformer = new ClientTransformer($this->serializer);
return $this->includeCollection($credit->payments, $transformer, ENTITY_PAYMENT);
}
return $this->includeItem($credit->client, $transformer, Client::class);
}
public function includeClient(quote $credit)
{
$transformer = new ClientTransformer($this->account, $this->serializer);
return $this->includeItem($credit->client, $transformer, ENTITY_CLIENT);
}
public function includeExpenses(quote $credit)
{
$transformer = new ExpenseTransformer($this->account, $this->serializer);
return $this->includeCollection($credit->expenses, $transformer, ENTITY_EXPENSE);
}
*/
public function includeDocuments(Credit $credit)
{
$transformer = new DocumentTransformer($this->serializer);