2020-02-25 09:33:53 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-02-25 09:33:53 +01:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-02-25 09:33:53 +01:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
use App\Models\CreditInvitation;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
class CreditInvitationTransformer extends EntityTransformer
|
|
|
|
{
|
|
|
|
use MakesHash;
|
2020-02-25 09:33:53 +01:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
public function transform(CreditInvitation $invitation)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $this->encodePrimaryKey($invitation->id),
|
|
|
|
'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id),
|
|
|
|
'key' => $invitation->key,
|
2020-09-06 11:38:10 +02:00
|
|
|
'link' => $invitation->getLink() ?: '',
|
|
|
|
'sent_date' => $invitation->sent_date ?: '',
|
|
|
|
'viewed_date' => $invitation->viewed_date ?: '',
|
|
|
|
'opened_date' => $invitation->opened_date ?: '',
|
2020-03-21 06:37:30 +01:00
|
|
|
'updated_at' => (int) $invitation->updated_at,
|
|
|
|
'archived_at' => (int) $invitation->deleted_at,
|
|
|
|
'created_at' => (int) $invitation->created_at,
|
|
|
|
];
|
|
|
|
}
|
2020-02-25 09:33:53 +01:00
|
|
|
}
|