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

muzafferdede's avatar

How to group relation column in Nova Metrics

hi, i am trying to group Partition metrics by relation but i am not sure how to select relation table column name, what i am trying to do is:


    public function calculate(NovaRequest $request)
    {
        return $this->count($request, SaleItem::where('salable_type', Product::class), 'salable.name', 'quantity');
    }

i got error unknow salable.name colmun name error.

What is the correct way to do so?

0 likes
2 replies
jlrdw's avatar

Try putting your aggregate with a where.

Please or to participate in this conversation.