2019-04-18 08:11:37 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-04-18 08:11:37 +02:00
|
|
|
|
|
|
|
namespace App\Transformers;
|
|
|
|
|
|
|
|
use App\Models\CompanyToken;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class CompanyTokenTransformer.
|
|
|
|
*/
|
|
|
|
class CompanyTokenTransformer 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 [
|
2020-07-05 14:08:28 +02:00
|
|
|
'id' => $this->encodePrimaryKey($company_token->id),
|
2020-07-06 00:21:39 +02:00
|
|
|
'user_id' => $this->encodePrimaryKey($company_token->user_id),
|
2019-04-18 08:11:37 +02:00
|
|
|
'token' => $company_token->token,
|
2019-09-27 00:14:02 +02:00
|
|
|
'name' => $company_token->name ?: '',
|
2020-09-06 11:38:10 +02:00
|
|
|
'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,
|
2019-04-18 08:11:37 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|