2020-01-20 02:31:58 +01:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-01-20 02:31:58 +01:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-01-20 02:31:58 +01:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-01-20 02:31:58 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
use App\Models\VendorContact;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class VendorContactTransformer.
|
|
|
|
*/
|
|
|
|
class VendorContactTransformer extends EntityTransformer
|
|
|
|
{
|
|
|
|
use MakesHash;
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-01-20 02:31:58 +01:00
|
|
|
/**
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param VendorContact $vendor
|
2020-01-20 02:31:58 +01:00
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function transform(VendorContact $vendor)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $this->encodePrimaryKey($vendor->id),
|
|
|
|
'first_name' => $vendor->first_name ?: '',
|
|
|
|
'last_name' => $vendor->last_name ?: '',
|
2022-11-12 23:35:04 +01:00
|
|
|
'send_email' => (bool)$vendor->send_email,
|
2020-01-20 02:31:58 +01:00
|
|
|
'email' => $vendor->email ?: '',
|
2020-09-06 11:38:10 +02:00
|
|
|
'created_at' => (int) $vendor->created_at,
|
|
|
|
'updated_at' => (int) $vendor->updated_at,
|
|
|
|
'archived_at' => (int) $vendor->deleted_at,
|
2020-01-20 02:31:58 +01:00
|
|
|
'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 ?: '',
|
2022-08-04 08:22:48 +02:00
|
|
|
'link' => $vendor->getLoginLink(),
|
2023-08-11 00:10:21 +02:00
|
|
|
'last_login' => (int)$vendor->last_login,
|
2023-10-26 12:09:22 +02:00
|
|
|
'password' => empty($vendor->password) ? '' : '**********',
|
2020-01-20 02:31:58 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|