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;
|
|
|
|
use League\Fractal;
|
|
|
|
|
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,
|
|
|
|
'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
|
2015-11-01 23:10:20 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|