Skip to content

Commit

Permalink
Code refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Jun 24, 2024
1 parent a4315dc commit 3d2c22f
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,24 @@ public function registerOnboardingSteps()

protected function extendDashboardChartsDatasets()
{
Charts::registerDatasets(function() {
if (!ReviewSettings::allowReviews()) {
return [];
}
Charts::extend(function($charts) {
$charts->bindEvent('charts.extendDatasets', function() use ($charts) {
if (!ReviewSettings::allowReviews()) {
return;
}

return [
'reviews' => [
'label' => 'lang:igniter.local::default.reviews.text_title',
'color' => '#FFB74D',
'model' => Review::class,
'column' => 'created_at',
],
];
$charts->addDataset('reports', [
'sets' => [
'reviews' => [
'label' => 'lang:igniter.local::default.reviews.text_title',
'color' => '#FFB74D',
'model' => Review::class,
'column' => 'created_at',
'priority' => 40,
],
],
]);
});
});
}

Expand Down

0 comments on commit 3d2c22f

Please sign in to comment.