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