= CURRENT_DATE - INTERVAL '3 days' ORDER BY siren.active_time DESC ")); return view('layout.notification.siren',compact('sirenData')); } // Function Retrieve Rainfall Notification History public function rfHistory() { $rfHistory = DB::table('station') ->join('notification','station.stationid','notification.stationid') ->select('station.*','notification.*') ->where('notification.stationtype',1) ->orderByDesc('notification.timestamp') ->paginate(10); return view('layout.notification.history.rainfall',compact('rfHistory')); } // Function Retrieve Water Level History public function wlHistory() { $wlHistory = DB::table('station') ->join('notification','station.stationid','notification.stationid') ->select('station.*','notification.*') ->where('notification.stationtype',2) ->orderByDesc('notification.timestamp') ->paginate(10); return view('layout.notification.history.waterlevel',compact('wlHistory')); } //Function Export PDF for Rainfall History public function exportHistoryRfPDF() { $rfHistory = DB::table('station') ->join('notification','station.stationid','notification.stationid') ->select('station.*','notification.*') ->where('notification.stationtype',1) ->orderByDesc('notification.timestamp')->get(); $pdf = Pdf::loadView('pdf.rfhistory',compact('rfHistory')) ->setPaper('a4','portrait'); return $pdf->download('Rainfall Alarm History.pdf'); } // Function Export PDF for Water Level History public function exportHistoryWlPDF() { $wlHistory = DB::table('station') ->join('notification','station.stationid','notification.stationid') ->select('station.*','notification.*') ->where('notification.stationtype',2) ->orderByDesc('notification.timestamp')->get(); $pdf = Pdf::loadView('pdf.wlhistory',compact('wlHistory')) ->setPaper('a4','portrait'); return $pdf->download('Water Level Alarm History.pdf'); } }