nova-filterable-cards icon indicating copy to clipboard operation
nova-filterable-cards copied to clipboard

Cannot declare the 'FilterableValue' to my card

Open oliverbj opened this issue 7 years ago • 1 comments

Hi there

  • Laravel 5.7

I am a bit confused on how to use this package. I have followed the readme:

This is my Metric Card: NewFlowStatistics.php

use Beyondcode\FilterableCard\FilterableValue;

class NewFlowStatistics extends Value
{
    use FilterableValue;

      protected $filters = [
        'flow_name' => [
            'type' => 'text'
        ],
    ];

And then in the same file, this is my calculate() function:

    public function calculate(Request $request)
    {
        return $this->value($request, FlowStatistics::class);
    }

However this gives me below error:

Declaration of Beyondcode\FilterableCard\FilterableValue::aggregate($request, $model, $function, $column = NULL) should be compatible with Laravel\Nova\Metrics\Value::aggregate($request, $model, $function, $column = NULL, $dateColumn = NULL)

oliverbj avatar Nov 19 '18 11:11 oliverbj

Fixed this by just using:

use Beyondcode\FilterableCard\Filterable;
use Filterable;

Instead of

use Beyondcode\FilterableCard\FilterableValue;
use FilterableValue;

oliverbj avatar Nov 26 '18 15:11 oliverbj