mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-10-27 05:57:14 +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
|
protected function getData(): array
|
||||||
{
|
{
|
||||||
$categories = Category::where('type', 'game')->get()->sortBy('id')->sortDesc();
|
$categories = Category::where('type', 'game')->get();
|
||||||
$categoryNames = [];
|
$categoryNames = [];
|
||||||
|
|
||||||
foreach ($categories as $obj){
|
foreach ($categories as $obj){
|
||||||
|
|
@ -34,13 +34,15 @@ class PopularCategoryChart extends ChartWidget
|
||||||
|
|
||||||
$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')->sortBy('item.category_id')->sortDesc();
|
})->get()->groupBy('item.category_id');
|
||||||
|
|
||||||
|
|
||||||
$itemCategoriesCount = [];
|
$itemCategoriesCount = [];
|
||||||
|
|
||||||
foreach ($items as $item){
|
foreach ($items as $item){
|
||||||
$itemCategoriesCount[] = $item->count();
|
|
||||||
|
$itemCategoriesCount[] = $item->count();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue