1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Ninja/Transformers/QuoteTransformer.php

27 lines
739 B
PHP
Raw Normal View History

2015-11-03 20:03:24 +01:00
<?php namespace App\Ninja\Transformers;
use App\Models\Invoice;
use League\Fractal;
2015-11-08 22:12:50 +01:00
class QuoteTransformer extends EntityTransformer
2015-11-03 20:03:24 +01:00
{
protected $defaultIncludes = [
'invoice_items',
];
public function includeInvoiceItems($invoice)
{
2015-11-27 13:55:28 +01:00
$transformer = new InvoiceItemTransformer($this->account, $this->serializer);
return $this->includeCollection($invoice->invoice_items, $transformer, 'invoice_items');
2015-11-03 20:03:24 +01:00
}
public function transform(Invoice $invoice)
{
return [
2015-11-15 11:43:32 +01:00
'id' => (int) $invoice->public_id,
2015-11-03 20:03:24 +01:00
'quote_number' => $invoice->invoice_number,
'amount' => (float) $invoice->amount,
2015-12-17 09:19:56 +01:00
'quote_terms' => $invoice->terms,
2015-11-03 20:03:24 +01:00
];
}
}