Closed gdespirito closed 6 years ago
You can override getCreatedAtColumn
method on your model for now. Also note that it's the fourth parameter, the third is the column you wanna count.
I already fixed it on my app. But this is an easy fix. They just forgot to pass that variable to a function.
On Fri, Aug 24, 2018 at 5:22 AM Sergii Kauk notifications@github.com wrote:
You can override getCreatedAtColumn method on your model for now. Also note that it's the forth parameter, the third is the column you wanna count.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/laravel/nova-issues/issues/95#issuecomment-415689171, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDWhlKDk-wEYwPqwRE_NQFb70i4NfiVks5uT7fHgaJpZM4WKq8P .
-- Enviado con Gmail Mobile
Solution is presented in #108, but is really a duplicate of this issue.
I'm having a similar issue. I'm using Laravel Cashier and I want to display a value card for Cancelled Subscriptions but it's pulling from the created_at instead of the ends_at. I also have a value card that displays Active Subscriptions so overriding the getCreatedAtColumn in my model wouldn't work. Any ideas?
public function calculate(Request $request)
{
return $this->count($request, Subscription::class, 'ends_at');
}
@jringeisen the Value
metric type currently doesn't support anything other than the created_at
column on the model from the looks of it. I believe this original issue was regarding the Trend
metric. It would be a great addition as we may want to see how many records their are in a date range other than created at. Like "how many subscriptions where the trial ends this week"
@warren32 exactly. And it being an admin panel not sure why this would be left out. I would like to be able to track subscription cancellations but can't. Also, why would they include column in the count method if it only accepts created_at?
Will be fixed in next release.
Hi, any update on this?
return $this->count($request, Visit::class, 'startDate');
is running the query
select count(startDate
) as aggregate from visits
where created_at
between 2019-10-03 12:30:37 and 2019-11-02 12:30:37)
@totiherms you're using the wrong parameter:
return $this->count($request, Visit::class, null, 'startDate');
@totiherms you're using the wrong parameter:
return $this->count($request, Visit::class, null, 'startDate');
thanks!
/**
I've created a trend Metric, and used the default countByDays methods to aggregate my data, but i configured the third parameter to use a special column date, not the default created_at.
But for what can i see, that parameter is not used