Last active
March 9, 2020 20:47
-
-
Save abishekrsrikaanth/81264b456449a96de47547a668c7027a to your computer and use it in GitHub Desktop.
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
<?php | |
public function fields(Request $request) | |
{ | |
return [ | |
// ... All your other fields here | |
GroupByTool::make() | |
->usingModel(EventRegistration::class) | |
->selectColumns([ | |
"shirt_size", | |
"COUNT('shirt_size') as total_count", | |
]) | |
->groupBy(['shirt_size']) | |
->usingWhere([ | |
'eventable_type' => \App\Models\StandaloneEvent::class, | |
'eventable_id' => $this->id, | |
]) | |
->setTitle('Count by T-Shirt Sizes'), | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment