generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add table summaries for average, count, range, sum
- Loading branch information
1 parent
3669aa3
commit 285b688
Showing
13 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\FilamentTests\Stubs\Page\Index\Table\Summaries; | ||
|
||
use Closure; | ||
use CodeWithDennis\FilamentTests\Stubs\Base; | ||
|
||
class Average extends Base | ||
{ | ||
public Closure|bool $isTodo = true; | ||
|
||
public function getShouldGenerate(): bool | ||
{ | ||
return $this->getResourceTableColumnsWithSummarizers($this->resource) | ||
->filter(fn($column) => collect($column->getSummarizers()) | ||
->filter(fn($summarizer) => $summarizer::class === \Filament\Tables\Columns\Summarizers\Average::class) | ||
->count()) | ||
->isNotEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\FilamentTests\Stubs\Page\Index\Table\Summaries; | ||
|
||
use Closure; | ||
use CodeWithDennis\FilamentTests\Stubs\Base; | ||
|
||
class Count extends Base | ||
{ | ||
public Closure|bool $isTodo = true; | ||
|
||
public function getShouldGenerate(): bool | ||
{ | ||
return $this->getResourceTableColumnsWithSummarizers($this->resource) | ||
->filter(fn($column) => collect($column->getSummarizers()) | ||
->filter(fn($summarizer) => $summarizer::class === \Filament\Tables\Columns\Summarizers\Count::class) | ||
->count()) | ||
->isNotEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\FilamentTests\Stubs\Page\Index\Table\Summaries; | ||
|
||
use Closure; | ||
use CodeWithDennis\FilamentTests\Stubs\Base; | ||
|
||
class Range extends Base | ||
{ | ||
public Closure|bool $isTodo = true; | ||
|
||
public function getShouldGenerate(): bool | ||
{ | ||
return $this->getResourceTableColumnsWithSummarizers($this->resource) | ||
->filter(fn($column) => collect($column->getSummarizers()) | ||
->filter(fn($summarizer) => $summarizer::class === \Filament\Tables\Columns\Summarizers\Range::class) | ||
->count()) | ||
->isNotEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace CodeWithDennis\FilamentTests\Stubs\Page\Index\Table\Summaries; | ||
|
||
use Closure; | ||
use CodeWithDennis\FilamentTests\Stubs\Base; | ||
|
||
class Sum extends Base | ||
{ | ||
public Closure|bool $isTodo = true; | ||
|
||
public function getShouldGenerate(): bool | ||
{ | ||
return true; | ||
// return $this->getResourceTableColumnsWithSummarizers($this->resource)->isNotEmpty(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
it('can add a table filter', function () { | ||
|
||
})->group('filters', 'table')->todo(); | ||
// | ||
}){{ RESOLVED_GROUP_METHOD }}->todo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
it('can remove a table filter', function () { | ||
|
||
})->group('filters', 'table')->todo(); | ||
// | ||
}){{ RESOLVED_GROUP_METHOD }}->todo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
it('can average values in a column', function () { | ||
// | ||
}){{ RESOLVED_GROUP_METHOD }}->todo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
it('can count values in a column', function () { | ||
// | ||
}){{ RESOLVED_GROUP_METHOD }}->todo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
it('can range values in a column', function () { | ||
// | ||
}){{ RESOLVED_GROUP_METHOD }}->todo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
it('can sum values in a column', function () { | ||
// | ||
}){{ RESOLVED_GROUP_METHOD }}->todo(); |