1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00
invoiceninja/app/Ninja/Transformers/VendorContactTransformer.php

24 lines
730 B
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Ninja\Transformers;
2016-01-06 20:52:09 +01:00
use App\Models\VendorContact;
2016-01-07 16:21:13 +01:00
// vendor
2016-01-06 20:52:09 +01:00
class VendorContactTransformer extends EntityTransformer
{
public function transform(VendorContact $contact)
{
2016-05-03 22:02:29 +02:00
return array_merge($this->getDefaults($contact), [
2016-01-06 20:52:09 +01:00
'id' => (int) $contact->public_id,
2018-06-26 13:48:32 +02:00
'first_name' => $contact->first_name ?: '',
'last_name' => $contact->last_name ?: '',
'email' => $contact->email ?: '',
2016-01-06 20:52:09 +01:00
'updated_at' => $this->getTimestamp($contact->updated_at),
'archived_at' => $this->getTimestamp($contact->deleted_at),
'is_primary' => (bool) $contact->is_primary,
2018-06-26 13:48:32 +02:00
'phone' => $contact->phone ?: '',
2016-05-03 22:02:29 +02:00
]);
2016-01-06 20:52:09 +01:00
}
2017-01-30 17:05:31 +01:00
}