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

Antonella's avatar

Change Nova Resource name? (only on interface)

I would like to modify this function in order to replace the word "Details" with a boolean field of the DB.

I mean I have a model called: Poll

I mean I have a Resource called: ResourcePoll

When I click on the detail I am in the title:

Poll Details : 1

and I would like to replace it with

Poll <id field 1> : 1

I know this is the function that concerns him:

public static function singularLabel()
{
return Str::singular(static::label());
}

in name_app/nova/src/resource

I just have no idea how to take id and replace Details

0 likes
2 replies
Antonella's avatar
Antonella
OP
Best Answer
Level 6

i solved it like this:

public function title()
    {
        if ($this->field_bool == 1)
        return '(OK) '.$this->{static::$title};
        else return $this->{static::$title};
    }
MichalOravec's avatar

@gianmarx Never use else when you use return

public function title()
{
    if ($this->field_bool == 1) {
        return '(OK) '.$this->{static::$title};
    }

    return $this->{static::$title};
}

or

public function title()
{
    return ($this->field_bool == 1 ? '(OK) ' : '').$this->{static::$title};
}
1 like

Please or to participate in this conversation.