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

iboosensei's avatar

Nova partition metric : GroupByColumn error

Hello everyone.

I have created a partition metrics, but get a "Column not found : unknow column 'groupByColumn" in field list.

My code :

<?php

namespace App\Nova\Metrics;

use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Metrics\Partition;
use App\Lead;

class LeadsPerStatus extends Partition
{
    /**
     * Calculate the value of the metric.
     *
     * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
     * @return mixed
     */
    public function calculate(NovaRequest $request)
    {
        return $this->count($request, Lead::class, 'groupByColumn');
    }

    /**
     * Determine for how many minutes the metric should be cached.
     *
     * @return  \DateTimeInterface|\DateInterval|float|int
     */
    public function cacheFor()
    {
        // return now()->addMinutes(5);
    }

    /**
     * Get the URI key for the metric.
     *
     * @return string
     */
    public function uriKey()
    {
        return 'leads-per-status';
    }
}

Thanks

0 likes
1 reply
Sirik's avatar

Does the table "leads" contain a field named like "groupByColumn"?

Please or to participate in this conversation.