1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-22 09:21:34 +02:00
invoiceninja/app/Ninja/Transformers/UserTransformer.php

33 lines
1.2 KiB
PHP
Raw Normal View History

2015-11-01 23:10:20 +01:00
<?php namespace App\Ninja\Transformers;
2015-11-08 22:12:50 +01:00
use App\Models\Account;
2015-11-01 23:10:20 +01:00
use App\Models\User;
2015-11-08 22:12:50 +01:00
class UserTransformer extends EntityTransformer
2015-11-01 23:10:20 +01:00
{
public function transform(User $user)
{
return [
2015-11-15 11:43:32 +01:00
'id' => (int) ($user->public_id + 1),
2015-11-01 23:10:20 +01:00
'first_name' => $user->first_name,
'last_name' => $user->last_name,
'email' => $user->email,
2015-11-07 13:15:37 +01:00
'account_key' => $user->account->account_key,
2015-12-27 12:08:58 +01:00
'updated_at' => $this->getTimestamp($user->updated_at),
'deleted_at' => $this->getTimestamp($user->deleted_at),
2015-11-07 13:15:37 +01:00
'phone' => $user->phone,
2016-02-04 21:35:28 +01:00
//'username' => $user->username,
2015-11-07 13:15:37 +01:00
'registered' => (bool) $user->registered,
'confirmed' => (bool) $user->confirmed,
'oauth_user_id' => $user->oauth_user_id,
2016-02-26 08:48:06 +01:00
'oauth_provider_id' => $user->oauth_provider_id,
'notify_sent' => (bool) $user->notify_sent,
'notify_viewed' => (bool) $user->notify_viewed,
'notify_paid' => (bool) $user->notify_paid,
'notify_approved' => (bool) $user->notify_approved,
2016-05-22 21:02:42 +02:00
'is_admin' => (bool) $user->is_admin,
'permissions' => (int) $user->getOriginal('permissions'),
2015-11-01 23:10:20 +01:00
];
}
2016-05-22 21:02:42 +02:00
}