2015-11-19 12:50:35 +01:00
|
|
|
<?php namespace App\Ninja\Transformers;
|
|
|
|
|
|
|
|
use App\Models\Product;
|
|
|
|
use League\Fractal;
|
|
|
|
|
|
|
|
class ProductTransformer extends EntityTransformer
|
|
|
|
{
|
|
|
|
public function transform(Product $product)
|
|
|
|
{
|
2016-05-04 08:53:43 +02:00
|
|
|
return array_merge($this->getDefaults($product), [
|
2015-11-19 12:50:35 +01:00
|
|
|
'id' => (int) $product->public_id,
|
|
|
|
'product_key' => $product->product_key,
|
|
|
|
'notes' => $product->notes,
|
|
|
|
'cost' => $product->cost,
|
|
|
|
'qty' => $product->qty,
|
2015-12-15 12:03:01 +01:00
|
|
|
'default_tax_rate_id' =>$product->default_tax_rate_id,
|
2015-12-28 10:14:21 +01:00
|
|
|
'updated_at' =>$this->getTimestamp($product->updated_at),
|
2016-02-01 03:32:12 +01:00
|
|
|
'archived_at' => $this->getTimestamp($product->deleted_at),
|
2016-05-03 22:02:29 +02:00
|
|
|
]);
|
2015-11-19 12:50:35 +01:00
|
|
|
}
|
|
|
|
}
|