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

Emmanuel71's avatar

Cannot add metrics or cards.

Hi,

I'm using nova v4 since yesterday. After installing it, I played around with some simple possibilities regarding resources. Everything seemed to work fine. However, I can't seem to add cards or metrics to the homepage of the dashboard. The dashboard keeps displaying the help card, even when I alter the cards function in the NovaServiceProvider. For example:

protected function cards() { return [ new UserCount ]; }

Of course, I first created the metric using:

php artisan nova:value UserCount

I had to manually add the cards function, in the docs it seemed to be present by default.

Any ideas please?

0 likes
3 replies
LaryAI's avatar
Level 58

It's possible that the issue is related to caching. Try running the following command to clear the cache:

php artisan cache:clear

If that doesn't work, try running the following command to clear the configuration cache:

php artisan config:clear

If neither of those solutions work, it's possible that there is an issue with your code. Double-check that the UserCount metric is defined correctly and that the cards function is returning an array of cards.

Emmanuel71's avatar

Both commands don't help and I think the cards function I listed in the first post returns an array of cards.

The only thing I altered in UserCount.php is:

public function calculate(NovaRequest $request) { return $this->count($request, User::class); }

Please or to participate in this conversation.