mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
0fbda85a59
- Removed unused uses - Type hinting for method parameters - Removed commented code - Introduced comments for classes and methods - Short array syntax
26 lines
719 B
PHP
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,
|
|
];
|
|
}
|
|
} |