1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00
invoiceninja/app/Ninja/Transformers/ContactTransformer.php

29 lines
891 B
PHP
Raw Normal View History

2015-11-03 15:21:17 +01:00
<?php namespace App\Ninja\Transformers;
use App\Models\Contact;
/**
* Class ContactTransformer
*/
2015-11-08 22:12:50 +01:00
class ContactTransformer extends EntityTransformer
2015-11-03 15:21:17 +01:00
{
/**
* @param Contact $contact
* @return array
*/
2015-11-03 15:21:17 +01:00
public function transform(Contact $contact)
{
2016-05-03 22:02:29 +02:00
return array_merge($this->getDefaults($contact), [
2015-11-15 11:43:32 +01:00
'id' => (int) $contact->public_id,
2015-11-03 15:21:17 +01:00
'first_name' => $contact->first_name,
'last_name' => $contact->last_name,
'email' => $contact->email,
2015-12-27 12:08:58 +01:00
'updated_at' => $this->getTimestamp($contact->updated_at),
'archived_at' => $this->getTimestamp($contact->deleted_at),
2015-11-07 13:15:37 +01:00
'is_primary' => (bool) $contact->is_primary,
'phone' => $contact->phone,
'last_login' => $contact->last_login,
'send_invoice' => (bool) $contact->send_invoice,
2016-05-03 22:02:29 +02:00
]);
2015-11-03 15:21:17 +01:00
}
}