1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Transformers/VendorContactTransformer.php
David Bomba f0bac9e077
Create Test Data fixes (#3252)
* add types to transformers

* minor fixes for test data creator
2020-01-27 21:53:08 +11:00

48 lines
1.3 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Transformers;
use App\Models\VendorContact;
use App\Utils\Traits\MakesHash;
/**
* Class VendorContactTransformer.
*
*/
class VendorContactTransformer extends EntityTransformer
{
use MakesHash;
/**
* @param ClientContact $vendor
*
* @return array
*
*/
public function transform(VendorContact $vendor)
{
return [
'id' => $this->encodePrimaryKey($vendor->id),
'first_name' => $vendor->first_name ?: '',
'last_name' => $vendor->last_name ?: '',
'email' => $vendor->email ?: '',
'updated_at' => (int)$vendor->updated_at,
'archived_at' => (int)$vendor->deleted_at,
'is_primary' => (bool) $vendor->is_primary,
'phone' => $vendor->phone ?: '',
'custom_value1' => $vendor->custom_value1 ?: '',
'custom_value2' => $vendor->custom_value2 ?: '',
'custom_value3' => $vendor->custom_value3 ?: '',
'custom_value4' => $vendor->custom_value4 ?: '',
];
}
}