mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-12-24 09:57:14 +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
|
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);
|
//foreach ($categories as $obj){
|
||||||
$categoryNames = [];
|
// $categoryNames[] = $obj->name;
|
||||||
|
//}
|
||||||
foreach ($categories as $obj){
|
|
||||||
$categoryNames[] = $obj->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
||||||
return $query->where('type', 'game');
|
return $query->where('type', 'game');
|
||||||
})->get()->groupBy('item.category_id')->sortByDesc('item.category_id');
|
})->get()->groupBy('item.category_id')->sortBy('item.category_id');
|
||||||
|
|
||||||
|
|
||||||
$itemCategoriesCount = [];
|
$itemCategoriesCount = [];
|
||||||
|
|
@ -54,7 +52,7 @@ class PopularCategoryChart extends ChartWidget
|
||||||
"hoverOffset" => 4,
|
"hoverOffset" => 4,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'labels' => $categoryNames,
|
'labels' => $categories,
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue