1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/app/Ninja/Transformers/QuoteTransformer.php
2015-11-03 21:03:24 +02:00

26 lines
639 B
PHP

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