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

26 lines
847 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-11-07 13:15:37 +01:00
'user_id' => (int) $contact->user_id,
'updated_at' => $contact->updated_at,
'deleted_at' => $contact->deleted_at,
'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-19 09:42:53 +01:00
'client_id' => $contact->client->public_id
2015-11-03 15:21:17 +01:00
];
}
}