5

I'm trying to implement a card with a trend-metric in Laravel Nova. Is there any way to update the label of the card?

So in my case change "Participations Per Station" into something else.

l

Bergrebell
  • 4,263
  • 4
  • 40
  • 53

2 Answers2

9

You can either change the file name, or add this to your ParticipationsPerStation.php in Nova/Metrics

public function name()
{
    return 'Different Name';
}
  • 1
    @PeterPiper happy to help man, if you go to your metric file, you'll see that it extends `Partition` and `Partitions` extends `Metric`, and in `Metric.php` you will find `public function name`, there you can see that it will look for a `name` function in your file first, if it doesn't find it, it will `humanize` the file name. – MohammadAbusaleh May 09 '19 at 12:57
  • 1
    awesome thanks! i was so focused on searching for a label method that i must have missed it :) – Bergrebell May 09 '19 at 13:18
3

You can also just set the name in your metric using the name property like this.

public $name = 'Total Departments';
Matovu Ronald
  • 782
  • 11
  • 13