View file File name : ChartData.php Content :<?php namespace App\Charts; class ChartData { protected array $labels = []; protected array $values = []; protected string $title = ''; protected string $datasetName = ''; /** * @return array */ public function getLabels(): array { return $this->labels; } public function setLabels(array $labels): static { $this->labels = $labels; return $this; } public function getValues(): array { return $this->values; } /** * @param array $values * @return ChartData */ public function setValues(array $values): static { $this->values = $values; return $this; } public function getTitle(): string { return $this->title; } /** * @param string $title * @return ChartData */ public function setTitle(string $title): static { $this->title = $title; return $this; } /** * @param string $datasetName * @return ChartData */ public function setDatasetName(string $datasetName): static { $this->datasetName = $datasetName; return $this; } public function make(): array{ return [ 'labels' => $this->getLabels(), 'values' => $this->getValues(), 'title' => $this->getTitle(), 'datasetName'=> $this->datasetName, ]; } }