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

Romain's avatar
Level 30

Title from relationship

Hey there,

I have a simple Comment resource in Nova. Of course it BelongTo a Post. When editing, I want the title of the post to be the title of the resource.

By that I mean that when I go edit a comment, I want to see the name of the post at the top: Comment Details: Post name

At the moment, if I add post to the $title property of my resource, I see the whole Post object. But I can't find a way to get the post->title.

Is there a way to do that?

Thanks

0 likes
2 replies
bugsysha's avatar

Not sure if this works, but try adding computed field.

Text::make('Post title', function () {
    return $this->post->title;
})->showOnUpdating(),

I'm not sure if this can be visible while editing.

Romain's avatar
Level 30

@bugsysha sorry for the delayed reply. Your solution does not work for me. I want to show a relation field as the title of a resource being edited.

I've looked through the code and I don't think it's possible at the moment.

Thanks for your answer thou

Please or to participate in this conversation.