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