1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Ninja/Transformers/ContactTransformer.php

24 lines
785 B
PHP
Raw Normal View History

2015-11-03 15:21:17 +01:00
<?php namespace App\Ninja\Transformers;
2015-11-08 22:12:50 +01:00
use App\Models\Account;
2015-11-03 15:21:17 +01:00
use App\Models\Contact;
use League\Fractal;
2015-11-08 22:12:50 +01:00
class ContactTransformer extends EntityTransformer
2015-11-03 15:21:17 +01:00
{
public function transform(Contact $contact)
{
return [
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,
2015-11-15 12:04:06 +01:00
'account_key' => $this->account->account_key,
2015-11-03 15:21:17 +01:00
];
}
}