2015-11-03 20:03:24 +01:00
|
|
|
<?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 [
|
2015-11-07 13:15:37 +01:00
|
|
|
'public_id' => (int) $invoice->public_id,
|
2015-11-03 20:03:24 +01:00
|
|
|
'quote_number' => $invoice->invoice_number,
|
|
|
|
'amount' => (float) $invoice->amount,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|