2017-01-30 21:40:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Ninja\Transformers;
|
2016-06-13 20:05:28 +10:00
|
|
|
|
|
|
|
|
use App\Models\ExpenseCategory;
|
|
|
|
|
|
2016-12-29 18:17:17 +02:00
|
|
|
/**
|
|
|
|
|
* @SWG\Definition(definition="ExpenseCategory", @SWG\Xml(name="ExpenseCategory"))
|
|
|
|
|
*/
|
2016-06-13 20:05:28 +10:00
|
|
|
class ExpenseCategoryTransformer extends EntityTransformer
|
|
|
|
|
{
|
2016-12-29 18:17:17 +02:00
|
|
|
/**
|
2017-01-30 21:40:43 +02:00
|
|
|
* @SWG\Property(property="id", type="integer", example=1, readOnly=true)
|
|
|
|
|
* @SWG\Property(property="name", type="string", example="Sample")
|
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 21:40:43 +02:00
|
|
|
*/
|
2016-06-13 20:05:28 +10:00
|
|
|
public function transform(ExpenseCategory $expenseCategory)
|
|
|
|
|
{
|
|
|
|
|
return array_merge($this->getDefaults($expenseCategory), [
|
|
|
|
|
'id' => (int) $expenseCategory->public_id,
|
|
|
|
|
'name' => $expenseCategory->name,
|
|
|
|
|
'updated_at' => $this->getTimestamp($expenseCategory->updated_at),
|
|
|
|
|
'archived_at' => $this->getTimestamp($expenseCategory->deleted_at),
|
|
|
|
|
]);
|
|
|
|
|
}
|
2016-12-29 18:17:17 +02:00
|
|
|
}
|