2015-11-03 15:21:17 +01:00
|
|
|
<?php namespace App\Ninja\Transformers;
|
|
|
|
|
|
|
|
use App\Models\Contact;
|
|
|
|
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
|
|
|
* Class ContactTransformer
|
|
|
|
*/
|
2015-11-08 22:12:50 +01:00
|
|
|
class ContactTransformer extends EntityTransformer
|
2015-11-03 15:21:17 +01:00
|
|
|
{
|
2016-07-03 18:11:58 +02: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,
|
2016-01-29 00:08:11 +01:00
|
|
|
'send_invoice' => (bool) $contact->send_invoice,
|
2016-05-03 22:02:29 +02:00
|
|
|
]);
|
2015-11-03 15:21:17 +01:00
|
|
|
}
|
|
|
|
}
|