mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-10-26 23:47:13 +01:00
Compare commits
No commits in common. "b4f2e658adea5f5ddc41946b34b3f15d68035889" and "a9430680731574f86e8c54a7b14d7155e8daff2c" have entirely different histories.
b4f2e658ad
...
a943068073
1 changed files with 6 additions and 4 deletions
|
|
@ -25,7 +25,7 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
protected function getData(): array
|
||||
{
|
||||
$categories = Category::where('type', 'game')->get()->sortBy('id')->sortDesc();
|
||||
$categories = Category::where('type', 'game')->get();
|
||||
$categoryNames = [];
|
||||
|
||||
foreach ($categories as $obj){
|
||||
|
|
@ -34,15 +34,17 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
||||
return $query->where('type', 'game');
|
||||
})->get()->groupBy('item.category_id')->sortBy('item.category_id')->sortDesc();
|
||||
})->get()->groupBy('item.category_id');
|
||||
|
||||
|
||||
$itemCategoriesCount = [];
|
||||
|
||||
foreach ($items as $item){
|
||||
$itemCategoriesCount[] = $item->count();
|
||||
|
||||
$itemCategoriesCount[] = $item->count();
|
||||
|
||||
}
|
||||
|
||||
|
||||
return [
|
||||
'datasets' => [
|
||||
[
|
||||
|
|
|
|||
Loading…
Reference in a new issue