1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/app/Ninja/Transformers/UserTransformer.php
Holger Lösken 0fbda85a59 Code Refactoring
- Removed unused uses
- Type hinting for method parameters
- Removed commented code
- Introduced comments for classes and methods
- Short array syntax
2016-07-03 16:19:22 +00:00

32 lines
1.2 KiB
PHP

<?php namespace App\Ninja\Transformers;
use App\Models\Account;
use App\Models\User;
class UserTransformer extends EntityTransformer
{
public function transform(User $user)
{
return [
'id' => (int) ($user->public_id + 1),
'first_name' => $user->first_name,
'last_name' => $user->last_name,
'email' => $user->email,
'account_key' => $user->account->account_key,
'updated_at' => $this->getTimestamp($user->updated_at),
'deleted_at' => $this->getTimestamp($user->deleted_at),
'phone' => $user->phone,
//'username' => $user->username,
'registered' => (bool) $user->registered,
'confirmed' => (bool) $user->confirmed,
'oauth_user_id' => $user->oauth_user_id,
'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,
'is_admin' => (bool) $user->is_admin,
'permissions' => (int) $user->getOriginal('permissions'),
];
}
}