mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-10-26 17:17:14 +01:00
Updated chart for games per category
This commit is contained in:
parent
a943068073
commit
c7b1c5120b
1 changed files with 5 additions and 5 deletions
|
|
@ -25,7 +25,7 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
protected function getData(): array
|
||||
{
|
||||
$categories = Category::where('type', 'game')->get();
|
||||
$categories = Category::where('type', 'game')->get()->sortBy('id')->sortDesc();
|
||||
$categoryNames = [];
|
||||
|
||||
foreach ($categories as $obj){
|
||||
|
|
@ -34,16 +34,16 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
||||
return $query->where('type', 'game');
|
||||
})->get()->groupBy('item.category_id');
|
||||
})->get()->groupBy('item.category_id')->sortBy('item.category_id')->sortDesc();
|
||||
|
||||
|
||||
$itemCategoriesCount = [];
|
||||
|
||||
foreach ($items as $item){
|
||||
|
||||
$itemCategoriesCount[] = $item->count();
|
||||
|
||||
$itemCategoriesCount[] = $item->count();
|
||||
}
|
||||
|
||||
dd($items);
|
||||
|
||||
return [
|
||||
'datasets' => [
|
||||
|
|
|
|||
Loading…
Reference in a new issue