diff --git a/src/ProcessDataSource.php b/src/ProcessDataSource.php index 1ba8db0e..28257801 100644 --- a/src/ProcessDataSource.php +++ b/src/ProcessDataSource.php @@ -347,6 +347,7 @@ private function applySummaries(MorphToMany|EloquentBuilder|BaseCollection|Query return; } + $formatterFound = false; foreach ($summarizeFormat as $field => $format) { $parts = explode('.', $field); @@ -354,11 +355,16 @@ private function applySummaries(MorphToMany|EloquentBuilder|BaseCollection|Query $formats = str($parts[1])->replace(['{', '}'], ''); $allowedSummarizeFormats = explode(',', $formats); - if (in_array($summarize, $allowedSummarizeFormats)) { + if ($column->field === $parts[0] && in_array($summarize, $allowedSummarizeFormats)) { + $formatterFound = true; data_set($column, 'summarize.' . $summarize, $this->component->summarizeFormat()[$field]($value)); } } } + + if (!$formatterFound) { + data_set($column, 'summarize.' . $summarize, $value); + } } };