null, "user_id" => null, "chat_id" => null, ]; protected $casts = [ "user_id" => "integer", "chat_id" => "integer", ]; public function chat() : ?ChatEntity { $m = model(ChatModel::class); return $m->find($this->attributes['chat_id']); } public function user() : ?UserEntity { $m = model(UserModel::class); return $m->find($this->attributes['user_id'])->withAvatar(); } }