Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using $this when not in object context #57

Open
gianmarxWebmapp opened this issue Feb 22, 2021 · 0 comments
Open

using $this when not in object context #57

gianmarxWebmapp opened this issue Feb 22, 2021 · 0 comments

Comments

@gianmarxWebmapp
Copy link

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'),
            ]
        ]
    ];
}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant