Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

777not888's avatar

How to display all fields of related resource in details?

Hello everyone, tell me who knows. There is a User resource and a separate Address resource, which is associated with the first one by address_id. How to display all Address fields in the Details field of the User resource, and not just the city, for example, which is registered in the title?

0 likes
2 replies
777not888's avatar

Solved. In Address resource:

public function title()
{
  return sprintf('%s, %s, %s, %s', $this->city, $this->district, $this->street, $this->build);
}

Please or to participate in this conversation.