This commit is contained in:
salam committed 2026-10-07 05:30:39 +02:00
1 parent 679038a503
commit d0e2f32501
2 files changed
+55 -50

No files matched your search

+22
View File
@@ -84,6 +84,28 @@ class Statistic extends BaseDashboard
return '';
}
/**
* Diese Methode liefert das Daten-Array für ALLE Widgets.
* Durch 'once()' läuft die Query pro Request exakt 1x.
*/
// public function getSharedWidgetData(): array
// {
// return once(function () {
// $filters = $this->getFilters();
// // Ihre MongoDB / Eloquent Query basierend auf den aktuellen Filtern
// return Order::query()
// ->when($filters['start_date'] ?? null, fn ($q, $date) => $q->where('created_at', '>=', $date))
// ->when($filters['status'] ?? null, fn ($q, $status) => $q->where('status', $status))
// ->selectRaw('count(*) as total_count, sum(total_price) as total_revenue, avg(total_price) as average_amount')
// ->first()
// ->toArray();
// });
// }
// // Im Widget -> Nutzt exakt dasselbe Array aus dem Speicher
// $sharedData = $this->getPage()->getSharedWidgetData();
public function filtersForm(Schema $schema): Schema
{
return $schema