-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathUserTransformer.php
36 lines (31 loc) · 1.05 KB
/
UserTransformer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Api\V1\Users\Transformers;
use App\Models\Auth\User;
use League\Fractal\TransformerAbstract;
class UserTransformer extends TransformerAbstract
{
/**
* Turn this item object into a generic array
*
* @return array
*/
public function transform(User $user)
{
return [
'id' => (int) $user->id,
'sp_id' => (int) $user->sp_id,
'code' => $user->code,
'first_name' => ucwords($user->first_name),
'last_name' => ucwords($user->last_name),
'email' => $user->email,
'username' => $user->username,
'verified' => (bool) $user->verified,
'activated' => (bool) $user->activated,
'banned' => (bool) $user->banned,
'on_trial' => (bool) $user->on_trial,
'subscribed' => (bool) $user->subscribed,
'resent' => (int) $user->resent,
'settings' => (array) $user->settings
];
}
}