Use firstOrCreate instead of create so db:seed can run safely on container restart without duplicate key violation.
5.7 KiB
Features & User Guide
Feature Overview
SIDES provides the following feature areas:
1. Public Dashboard (Map View)
Route: / or /dashboard
Access: Public (no auth required)
Controller: MapController::getCurrentData()
Displays an interactive Leaflet.js map showing all monitoring stations with their current readings:
- Station markers color-coded by status
- Popup showing latest rainfall, water level, and siren data
- Real-time station data from PostgreSQL
2. Rainfall Monitoring
Route: /rainfall
Access: Authenticated users
Controller: RainfallController::index()
- Table showing rainfall data for all rainfall-enabled stations
- Filter by station and date
- Displays: hourly, daily, and 7-day historical values
- Last data update timestamp
3. Rainfall Graph
Route: /rainfall/graph/{stationid}
Access: Authenticated users
Controller: RainfallController::rainfallGraph()
- Interactive chart showing hourly rainfall for the selected station today
- X-axis: time (HH:MM), Y-axis: rainfall value
4. Early Warning Threshold (IDF)
Route: /threshold
Access: Authenticated users
Controller: RainfallController::rainfallSum()
- 6-hour cumulative rainfall data for early warning
- Shows hourly values and timestamps for each of the last 6 hours
- Filter by station and date
- Threshold graph data available via API
5. Historical Rainfall
Route: /rainfall/historical
Access: Authenticated users
Controller: RainfallController::historicalRainfall()
- Detailed hourly rainfall breakdown (24 hours per row)
- Filter by station and date range
- Shows total 24h rainfall per day
- Export to Excel:
/rainfall/historical/export
6. Water Level Monitoring
Route: /waterlevel
Access: Authenticated users
Controller: WaterLevelController::index()
- Table showing current water level readings
- Displays: water level value, alert/warning/danger thresholds
- Filter by station and date
- Interactive water level graph
7. Historical Water Level
Route: /waterlevel/historical
Access: Authenticated users
Controller: WaterLevelController::wlHistory()
- Hourly water level data for a selected station and date
- Shows threshold levels alongside actual readings
- Export to Excel:
/waterlevel/historical/export
8. Siren Monitoring
Route: /siren
Access: Authenticated users
Controller: SirenController::index()
- Current siren status for all siren-equipped stations
- Shows last 3 days of siren activations
- Siren levels: Normal (N), Warning (L), Danger (H)
9. Siren History
Route: /sirenhistory
Access: Authenticated users
Controller: SirenController::SirenHistory()
- Paginated history of all siren activations (excluding Normal)
- Export to PDF:
/export/siren-history/pdf
10. Notifications
Rainfall Notifications: /notificationrf
Water Level Notifications: /notificationwl
Siren Notifications: /notificationsiren
Access: Authenticated users
Controller: NotificationController
- Shows today's threshold-triggered notifications
- Grouped by type (rainfall, water level, siren)
11. Notification History
Rainfall History: /historyrf
Water Level History: /historywl
Access: Authenticated users
Controller: NotificationController
- Paginated history of all notifications
- Export to PDF:
/export/rainfall-history/pdf/export/waterlevel-history/pdf
12. CCTV Links
Route: /cctv
Access: Authenticated users
Controller: cctvController::index()
- Lists stations with CCTV links (where
cctv_linkis not null andwaterlevel = 1) - Links open external CCTV feeds
13. Admin: Station Management
Route: /stationmanagement
Access: Admin only (access_level = 1)
Controller: AdminController
- List all stations (paginated, 5 per page)
- Add new station
- Edit station details (name, district, coordinates, type flags, CCTV link)
- Delete station
- Shows station type counts (rainfall, water level, siren)
14. Admin: User Management
Route: /usermgmt
Access: Admin only
Controller: AdminController
- List all users (paginated, 5 per page)
- Add new user
- Edit user details (name, email, access level, block/unblock)
- Reset user password
- Delete user
- Shows user counts by role
15. API Endpoints
Prefix: /api/
Auth: Custom login (no token-based auth)
| Endpoint | Method | Description |
|---|---|---|
/api/station/current |
GET | All stations with current data |
/api/station/rainfall |
GET | Current rainfall data per station |
/api/station/waterlevel |
GET | Current water level data per station |
/api/station/notification |
GET | Today's notifications per station |
/api/station/history |
GET | 3-day notification history |
/api/station/siren |
GET | Current siren status |
/api/station/siren/history |
GET | 3-day siren history |
/api/login |
POST | Login (username + password) |
/api/alert |
POST | Send FCM push notification |
16. Profile Management
Route: /profile
Access: Authenticated users
Controller: ProfileController (Breeze scaffold)
- Update name and email
- Update password
- Delete account
17. Localization
Route: /locale/{locale}
Access: Public
Controller: LocaleController
- Switch between English (
en) and Bahasa Malaysia (bm) - Persisted in session
- Applied via
LocalizationMiddlewareon every request
18. Authentication
Routes: /login, /register, /forgot-password, /reset-password
Access: Guest only (for login/register)
Scaffold: Laravel Breeze
- Email/password authentication
- Password reset via email (Gmail SMTP)
- Email verification
- Session-based auth