1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/Transformers/SubscriptionTransformer.php
David Bomba 05443d69ec
Implement CompanyToken and Subscriptions CRUD (#3609)
* Working on Tokens CRUD

* Fixes for company filters

* Working on Token CRUD

* Tests for tokens

* Fixes for OPENApi

* Subscriptions

* Subscriptions
2020-04-09 20:48:04 +10:00

40 lines
1.1 KiB
PHP

<?php
namespace App\Transformers;
use App\Models\Subscription;
use App\Utils\Traits\MakesHash;
class SubscriptionTransformer extends EntityTransformer
{
use MakesHash;
protected $defaultIncludes = [];
/**
* @var array
*/
protected $availableIncludes = [];
/**
* @param Activity $subscription
*
* @return array
*/
public function transform(Subscription $subscription)
{
return [
'id' => (string) $this->encodePrimaryKey($subscription->id),
'company_id' => (string) $this->encodePrimaryKey($subscription->company_id),
'user_id' => (string) $this->encodePrimaryKey($subscription->user_id),
'archived_at' => (int)$subscription->deleted_at,
'updated_at' => (int)$subscription->updated_at,
'created_at' => (int)$subscription->created_at,
'is_deleted' => (bool)$subscription->is_deleted,
'target_url' => $subscription->target_url ? (string) $subscription->target_url : '',
'event_id' => (string) $subscription->event_id,
'format' => (string) $subscription->format,
];
}
}