1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Ninja/Transformers/QuoteTransformer.php
Holger Lösken 0fbda85a59 Code Refactoring
- Removed unused uses
- Type hinting for method parameters
- Removed commented code
- Introduced comments for classes and methods
- Short array syntax
2016-07-03 16:19:22 +00:00

26 lines
719 B
PHP

<?php namespace App\Ninja\Transformers;
use App\Models\Invoice;
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,
'quote_terms' => $invoice->terms,
];
}
}