-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I would like to dynamically select the parameters, in the first function $this->id gives me the following error:
using $this when not in object context
while in the second no.
below the code:
` public static function getNovaChartjsSettings(): array
{
$r = TrelloCard::selectRaw('year(last_activity) year, monthname(last_activity) month, count(*) data')
->groupBy('year', 'month')
->orderBy('last_activity', 'asc')
->where('customer_id',$this->id)//using $this when not in object context
->get()->pluck('month');
return [
'default' => [
'type' => 'line',
'titleProp' => 'name',
'identProp' => 'id',
'height' => 600,
'indexColor' => '#999999',
'color' => '#FF0000',
'parameters' => $r,
'options' => ['responsive' => true, 'maintainAspectRatio' => false],
]
];
}
public function getAdditionalDatasets(): array
{
$r = TrelloCard::selectRaw('year(last_activity) year, monthname(last_activity) month, count(*) data')
->groupBy('year', 'month')
->orderBy('last_activity', 'asc')
->where('customer_id',$this->id)
->get();
return [
'default' => [
[
'label' => ' Month',
'borderColor' => '#f87900',
'fill' => '+1',
'backgroundColor' => 'rgba(20,20,20,0.2)',//For bar charts, this will be the fill color of the bar
'data' => $r->pluck('data'),
]
]
];
}`
Metadata
Metadata
Assignees
Labels
No labels