Here my model Chat.js
import Model from 'flarum/Model';
import mixin from 'flarum/utils/mixin';
export default class Chat extends mixin(Model, {
time: Model.attribute('time', Model.transformDate),
user: Model.hasOne('user'),
content: Model.attribute('content'),
}) {}
My serialize
class ChatSerializer extends AbstractSerializer
{
/**
* {@inheritdoc}
*/
protected $type = 'chats';
/**
* {@inheritdoc}
*/
protected function getDefaultAttributes($chat)
{
$attributes = [
'time' => $this->formatDate($chat->time),
'content' => $chat->content,
// 'user' => (int) $chat->user_id,
];
return $attributes;
}
/**
* @return \Tobscure\JsonApi\Relationship
*/
protected function user($chat)
{
return $this->hasOne($chat, UserSerializer::class);
}
}


Could you tell me why i didn't have relationships ?
i try to get user from chat and it return false.