square1-io / nova-metrics

Add support for resource-filters on your Laravel Nova Metrics
MIT License
27 stars 6 forks source link

Does this package supports default filter values? #2

Open nemrutco opened 4 years ago

nemrutco commented 4 years ago

When resource has a filter with default value, the request does not contain that filter. Maybe this package should do a check if resource has filters with default values and include it?

class Date extends DateFilter
{
...

public function
default()
{
    return '2020-02-01';
}

...
oleksandr-roskovynskyi commented 4 years ago

When resource has a filter with default value, the request does not contain that filter. Maybe this package should do a check if resource has filters with default values and include it?

class Date extends DateFilter
{
...

public function
default()
{
    return '2020-02-01';
}

...

add a field to class: $model = (new $filter->class('date'))->apply($request, $model, $filter->value);