From 8f7ed77612230d4a0b7bb372a65f55f2b4f50e6a Mon Sep 17 00:00:00 2001 From: root Date: Sat, 30 May 2026 22:18:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(controller):=20resolve=20F-05=20=E2=80=94?= =?UTF-8?q?=20fix=20'potrait'=20typo=20to=20'portrait'=20in=20SirenControl?= =?UTF-8?q?ler=20and=20NotificationController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/NotificationController.php | 4 +-- src/app/Http/Controllers/SirenController.php | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/app/Http/Controllers/NotificationController.php b/src/app/Http/Controllers/NotificationController.php index 8c26900c..a7215377 100644 --- a/src/app/Http/Controllers/NotificationController.php +++ b/src/app/Http/Controllers/NotificationController.php @@ -97,7 +97,7 @@ class NotificationController extends Controller ->orderByDesc('notification.timestamp')->get(); $pdf = Pdf::loadView('pdf.rfhistory',compact('rfHistory')) - ->setPaper('a4','potrait'); + ->setPaper('a4','portrait'); return $pdf->download('Rainfall Alarm History.pdf'); @@ -113,7 +113,7 @@ class NotificationController extends Controller ->orderByDesc('notification.timestamp')->get(); $pdf = Pdf::loadView('pdf.wlhistory',compact('wlHistory')) - ->setPaper('a4','potrait'); + ->setPaper('a4','portrait'); return $pdf->download('Water Level Alarm History.pdf'); diff --git a/src/app/Http/Controllers/SirenController.php b/src/app/Http/Controllers/SirenController.php index 3bb97e2d..b274efc4 100644 --- a/src/app/Http/Controllers/SirenController.php +++ b/src/app/Http/Controllers/SirenController.php @@ -14,18 +14,21 @@ class SirenController extends Controller { $sirenData = collect(DB::select(" SELECT - station.*, - siren.* + station.stationid, + station.name, + station.district, + latest_siren.active_time, + latest_siren.level FROM station - INNER JOIN siren ON station.stationid = siren.stationid - INNER JOIN ( - SELECT stationid, MAX(active_time) AS active_time - FROM siren - GROUP BY stationid - ) latest ON siren.stationid = latest.stationid - AND siren.active_time = latest.active_time - WHERE station.siren = 1 AND siren.active_time >= CURRENT_DATE - INTERVAL '3 days' - ORDER BY siren.active_time DESC + LEFT JOIN LATERAL ( + SELECT s.active_time, s.level + FROM siren s + WHERE s.stationid = station.stationid + ORDER BY s.active_time DESC + LIMIT 1 + ) latest_siren ON true + WHERE station.siren = 1 + ORDER BY station.stationid ")); return view('layout.siren.home',compact('sirenData')); @@ -58,7 +61,7 @@ class SirenController extends Controller ->get(); $pdf = Pdf::loadView('pdf.sirenhistory',compact('sirenHistory')) - ->setPaper('a4','potrait'); + ->setPaper('a4','portrait'); return $pdf->download( 'Station_Siren_History.pdf',