1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Transformers/CompanyTokenHashedTransformer.php

56 lines
1.4 KiB
PHP
Raw Normal View History

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2022-04-27 05:20:41 +02:00
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Transformers;
use App\Models\CompanyToken;
use App\Utils\Traits\MakesHash;
/**
* Class CompanyTokenHashedTransformer.
*/
class CompanyTokenHashedTransformer extends EntityTransformer
{
use MakesHash;
/**
* @var array
*/
protected $defaultIncludes = [
];
/**
* @var array
*/
protected $availableIncludes = [
];
/**
* @param CompanyToken $company_token
*
* @return array
*/
public function transform(CompanyToken $company_token)
{
return [
'id' => $this->encodePrimaryKey($company_token->id),
'user_id' => $this->encodePrimaryKey($company_token->user_id),
'token' => substr($company_token->token, 0, 10).'xxxxxxxxxxx',
'name' => $company_token->name ?: '',
'is_system' =>(bool) $company_token->is_system,
'updated_at' => (int) $company_token->updated_at,
'archived_at' => (int) $company_token->deleted_at,
'created_at' => (int) $company_token->created_at,
'is_deleted' => (bool) $company_token->is_deleted,
];
}
}