2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Ninja\Transformers;
|
2015-12-21 08:36:29 +01:00
|
|
|
|
|
|
|
use App\Models\TaxRate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @SWG\Definition(definition="TaxRate", @SWG\Xml(name="TaxRate"))
|
|
|
|
*/
|
|
|
|
class TaxRateTransformer extends EntityTransformer
|
|
|
|
{
|
2017-01-30 17:05:31 +01:00
|
|
|
/**
|
2017-01-30 20:40:43 +01:00
|
|
|
* @SWG\Property(property="id", type="integer", example=1, readOnly=true)
|
|
|
|
* @SWG\Property(property="name", type="string", example="GST")
|
|
|
|
* @SWG\Property(property="account_key", type="string", example="asimplestring", readOnly=true)
|
2017-03-08 17:03:35 +01:00
|
|
|
* @SWG\Property(property="rate", type="number", format="float", example=17.5)
|
2017-01-30 20:40:43 +01:00
|
|
|
* @SWG\Property(property="is_inclusive", type="boolean", example=false)
|
2017-03-09 11:11:45 +01:00
|
|
|
* @SWG\Property(property="updated_at", type="integer", example=1451160233, readOnly=true)
|
|
|
|
* @SWG\Property(property="archived_at", type="integer", example=1451160233, readOnly=true)
|
2017-01-30 20:40:43 +01:00
|
|
|
*/
|
2015-12-21 08:36:29 +01:00
|
|
|
public function transform(TaxRate $taxRate)
|
|
|
|
{
|
2016-05-03 22:02:29 +02:00
|
|
|
return array_merge($this->getDefaults($taxRate), [
|
2015-12-21 08:36:29 +01:00
|
|
|
'id' => (int) $taxRate->public_id,
|
|
|
|
'name' => $taxRate->name,
|
|
|
|
'rate' => (float) $taxRate->rate,
|
2017-01-02 12:38:58 +01:00
|
|
|
'is_inclusive' => (bool) $taxRate->is_inclusive,
|
2015-12-27 12:08:58 +01:00
|
|
|
'updated_at' => $this->getTimestamp($taxRate->updated_at),
|
|
|
|
'archived_at' => $this->getTimestamp($taxRate->deleted_at),
|
2016-05-03 22:02:29 +02:00
|
|
|
]);
|
2015-12-21 08:36:29 +01:00
|
|
|
}
|
2017-01-02 12:38:58 +01:00
|
|
|
}
|