From e78e79a8f5996214bbda6266b9cdbf63d9f7bf68 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 14 Jan 2022 19:15:37 +1100 Subject: [PATCH] Change sorting on graphs so that date is in date order --- app/Models/Domain.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/Domain.php b/app/Models/Domain.php index 6d2254a..ed83057 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -77,13 +77,14 @@ class Domain extends Model ->when($systems?->count(),function($query) use ($systems) { return $query->whereIn('fftn_id',$systems->pluck('addresses')->flatten()->pluck('id')->toArray()); }) ->where('datetime','>=',Carbon::now()->subMonths(self::STATS_MONTHS)->startOfMonth()) ->groupBy(['echoarea_id','echoareas.name','date']) - ->orderBy('echoareas.name') ->orderBy('date') + ->orderBy('echoareas.name') ->with(['echoarea']) ->get(); if ($byarea) return $echostats + ->sortBy('name') ->groupBy(['echoarea_id']) ->map(function($item,$key) { return [