mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-12-24 04:57:13 +01:00
Fixed widgets on admin view
This commit is contained in:
parent
aaa4980619
commit
7062c98853
1 changed files with 7 additions and 9 deletions
|
|
@ -25,18 +25,16 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
protected function getData(): array
|
||||
{
|
||||
$categories = Category::where('type', 'game')->get()->sortBy('id');
|
||||
$categories = Category::where('type', 'game')->get()->sortBy('id')->pluck('name');
|
||||
//$categoryNames = [];
|
||||
|
||||
//dd($categories);
|
||||
$categoryNames = [];
|
||||
|
||||
foreach ($categories as $obj){
|
||||
$categoryNames[] = $obj->name;
|
||||
}
|
||||
//foreach ($categories as $obj){
|
||||
// $categoryNames[] = $obj->name;
|
||||
//}
|
||||
|
||||
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
||||
return $query->where('type', 'game');
|
||||
})->get()->groupBy('item.category_id')->sortByDesc('item.category_id');
|
||||
})->get()->groupBy('item.category_id')->sortBy('item.category_id');
|
||||
|
||||
|
||||
$itemCategoriesCount = [];
|
||||
|
|
@ -54,7 +52,7 @@ class PopularCategoryChart extends ChartWidget
|
|||
"hoverOffset" => 4,
|
||||
],
|
||||
],
|
||||
'labels' => $categoryNames,
|
||||
'labels' => $categories,
|
||||
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue