1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 14:42:42 +01:00
invoiceninja/app/Ninja/Transformers/ActivityTransformer.php

36 lines
1.0 KiB
PHP
Raw Normal View History

2016-08-15 15:43:26 +02:00
<?php namespace App\Ninja\Transformers;
use App\Models\Activity;
/**
* @SWG\Definition(definition="Activity", @SWG\Xml(name="Activity"))
*/
class ActivityTransformer extends EntityTransformer
{
protected $defaultIncludes = [ ];
/**
* @var array
*/
protected $availableIncludes = [ ];
/**
* @param Client $client
* @return array
*/
public function transform(Activity $activity)
{
return [
2016-08-17 09:55:50 +02:00
'id' => $activity->key(),
2016-08-15 15:43:26 +02:00
'activity_type_id' => $activity->activity_type_id,
2016-09-19 09:05:13 +02:00
'client_id' => $activity->client ? $activity->client->public_id : null,
2016-08-15 15:43:26 +02:00
'user_id' => $activity->user->public_id + 1,
'invoice_id' => $activity->invoice ? $activity->invoice->public_id : null,
'payment_id' => $activity->payment ? $activity->payment->public_id : null,
'credit_id' => $activity->credit ? $activity->credit->public_id : null,
'updated_at' => $this->getTimestamp($activity->updated_at)
2016-08-15 15:43:26 +02:00
];
}
}