1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00
invoiceninja/app/Ninja/Transformers/ActivityTransformer.php
2016-08-17 10:55:50 +03:00

35 lines
944 B
PHP

<?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 [
'id' => $activity->key(),
'activity_type_id' => $activity->activity_type_id,
'client_id' => $activity->client->public_id,
'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,
];
}
}