1
0
mirror of https://github.com/flarum/core.git synced 2025-10-19 10:46:06 +02:00
Files
php-flarum/src/Api/Serializers/UserBasicSerializer.php
2015-05-06 11:25:19 +09:30

33 lines
709 B
PHP

<?php namespace Flarum\Api\Serializers;
class UserBasicSerializer extends BaseSerializer
{
/**
* The resource type.
*
* @var string
*/
protected $type = 'users';
/**
* Serialize attributes of a User model for JSON output.
*
* @param User $user The User model to serialize.
* @return array
*/
protected function attributes($user)
{
$attributes = [
'username' => $user->username,
'avatarUrl' => $user->avatar_url
];
return $this->extendAttributes($user, $attributes);
}
protected function groups()
{
return $this->hasMany('Flarum\Api\Serializers\GroupSerializer');
}
}