2015-11-01 23:10:20 +01:00
|
|
|
<?php namespace App\Ninja\Transformers;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
use League\Fractal;
|
|
|
|
use League\Fractal\TransformerAbstract;
|
|
|
|
|
|
|
|
class UserTransformer extends TransformerAbstract
|
|
|
|
{
|
|
|
|
public function transform(User $user)
|
|
|
|
{
|
|
|
|
return [
|
2015-11-07 13:15:37 +01:00
|
|
|
'public_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,
|
|
|
|
'updated_at' => $user->updated_at,
|
|
|
|
'deleted_at' => $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
|
2015-11-01 23:10:20 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|