1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Ninja/Transformers/QuoteTransformer.php
2015-11-27 14:55:28 +02:00

26 lines
693 B
PHP

<?php namespace App\Ninja\Transformers;
use App\Models\Invoice;
use League\Fractal;
class QuoteTransformer extends EntityTransformer
{
protected $defaultIncludes = [
'invoice_items',
];
public function includeInvoiceItems($invoice)
{
$transformer = new InvoiceItemTransformer($this->account, $this->serializer);
return $this->includeCollection($invoice->invoice_items, $transformer, 'invoice_items');
}
public function transform(Invoice $invoice)
{
return [
'id' => (int) $invoice->public_id,
'quote_number' => $invoice->invoice_number,
'amount' => (float) $invoice->amount,
];
}
}