Skip to content

Commit

Permalink
refactor: Improve getShouldGenerate method logic
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithDennis committed Apr 13, 2024
1 parent 285b688 commit 2d7b619
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Stubs/Page/Index/Table/Summaries/Sum.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class Sum extends Base

public function getShouldGenerate(): bool
{
return true;
// return $this->getResourceTableColumnsWithSummarizers($this->resource)->isNotEmpty();
return $this->getResourceTableColumnsWithSummarizers($this->resource)
->filter(fn($column) => collect($column->getSummarizers())
->filter(fn($summarizer) => $summarizer::class === \Filament\Tables\Columns\Summarizers\Sum::class)
->count())
->isNotEmpty();
}
}

0 comments on commit 2d7b619

Please sign in to comment.