1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Transformers/ClientContactTransformer.php

50 lines
1.4 KiB
PHP
Raw Normal View History

2019-03-28 22:35:35 +01:00
<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
2019-03-28 22:35:35 +01:00
namespace App\Transformers;
use App\Models\ClientContact;
2019-04-03 02:09:22 +02:00
use App\Utils\Traits\MakesHash;
2019-03-28 22:35:35 +01:00
/**
* Class ContactTransformer.
*
*/
class ClientContactTransformer extends EntityTransformer
{
2019-04-03 02:09:22 +02:00
use MakesHash;
2019-03-28 22:35:35 +01:00
/**
* @param ClientContact $contact
*
* @return array
*
*/
public function transform(ClientContact $contact)
{
2019-03-28 22:35:35 +01:00
return [
2019-04-03 02:09:22 +02:00
'id' => $this->encodePrimaryKey($contact->id),
2019-03-28 22:35:35 +01:00
'first_name' => $contact->first_name ?: '',
'last_name' => $contact->last_name ?: '',
'email' => $contact->email ?: '',
'updated_at' => $contact->updated_at,
'archived_at' => $contact->deleted_at,
'is_primary' => (bool) $contact->is_primary,
'is_locked' => (bool) $contact->is_locked,
2019-03-28 22:35:35 +01:00
'phone' => $contact->phone ?: '',
'custom_value1' => $contact->custom_value1 ?: '',
'custom_value2' => $contact->custom_value2 ?: '',
'custom_value3' => $contact->custom_value3 ?: '',
'custom_value4' => $contact->custom_value4 ?: '',
2019-03-28 22:35:35 +01:00
];
}
}