mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-12-24 09:47:12 +01:00
Fixed widgets on admin view
This commit is contained in:
parent
b4f2e658ad
commit
2da3264dd1
2 changed files with 10 additions and 10 deletions
|
|
@ -22,17 +22,15 @@ class AdminWidget extends BaseWidget
|
||||||
})->get()->groupBy('item_id');
|
})->get()->groupBy('item_id');
|
||||||
|
|
||||||
$itemName = "";
|
$itemName = "";
|
||||||
|
$itemCount = 0;
|
||||||
|
|
||||||
foreach ($items as $item){
|
foreach ($items as $item){
|
||||||
$itemCount = 0;
|
if(count($item) > $itemCount) {
|
||||||
|
|
||||||
if($item->count() > $itemCount) {
|
|
||||||
$itemName = $item[0]->item->desc;
|
$itemName = $item[0]->item->desc;
|
||||||
$itemCount = $item->count();
|
$itemCount = count($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
//Card::make(__('Total number of users'), User::count() ),
|
//Card::make(__('Total number of users'), User::count() ),
|
||||||
Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ),
|
Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ),
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ 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()->sortBy('id');
|
||||||
|
|
||||||
|
//dd($categories);
|
||||||
$categoryNames = [];
|
$categoryNames = [];
|
||||||
|
|
||||||
foreach ($categories as $obj){
|
foreach ($categories as $obj){
|
||||||
|
|
@ -34,13 +36,13 @@ 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')->sortBy('item.category_id');
|
||||||
|
|
||||||
|
|
||||||
$itemCategoriesCount = [];
|
$itemCategoriesCount = [];
|
||||||
|
|
||||||
foreach ($items as $item){
|
foreach ($items as $item){
|
||||||
$itemCategoriesCount[] = $item->count();
|
$itemCategoriesCount[] = count($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue