School Attendance with Geolocation
Attendance bound to a place. Students check in from their own phone inside a configured radius; staff run the whole school from one dashboard.
- My role
- Sole developer — Laravel back end, both interfaces and the mobile API.
- Field
- Web Development
Overview
Letting students mark their own attendance from their own phone removes the queue at the gate and opens an obvious hole. Geolocation closes it cheaply: the check-in page shows a live Leaflet map with the school, the allowed circle and the student’s position and accuracy, and the server only accepts the submission if the Haversine distance from the school point is inside the radius. The browser’s verdict is a convenience; the server recomputes it from the coordinates it receives and explains the refusal in metres.
The coordinates, the radius, the late tolerance and the check-in cut-off are settings, picked on a map in the admin panel, because no two schools share a footprint or a bell schedule. The status comes from the class timetable: on time until the first lesson plus the tolerance, late after that, closed after the cut-off. Checking out before the last lesson ends is accepted but noted on the record, and a scheduled command marks anyone still missing at 23:59 as absent — except on holidays or days covered by approved leave.
Attendance is never just presence. Students request leave with a photo or PDF attached and can cancel while it waits; an admin approves it, which writes an Izin or Sakit record for every day in the range inside one transaction, or rejects it with a note. The admin dashboard shows today’s numbers, a seven-day trend, pending leave and recent activity, and recaps export to Excel or PDF with the same filters as the screen.
The rules live in services, not controllers. The web pages and the REST API — Sanctum tokens with an admin or student ability — share the same Form Requests and call the same PresensiService and IzinService, so a future mobile app cannot disagree with the website. Login uses separate Laravel guards with rate limiting, and feature tests cover the radius, lateness, check-out, holidays, leave and every page rendering.
In pictures





Function
- Constraint
- Haversine distance checked on the server against a school point and radius set on a map
- Rules
- On time, late or closed from the timetable; absent marked automatically at 23:59
- Reach
- Web portal and a Sanctum REST API calling the same services
What it does
- 01Check-in and check-out from the student’s phone, with a live map, distance and GPS accuracy.
- 02Server-side radius check (Haversine) against a school point and radius chosen on a map.
- 03Automatic Hadir or Terlambat from the first lesson plus a configurable tolerance, and a check-in cut-off.
- 04Absent marked automatically every day at 23:59; disabled on holidays.
- 05Leave requests with an attachment, cancellable while pending; approval writes Izin/Sakit records per day.
- 06Admin dashboard with today’s figures, a seven-day trend, pending leave and recent activity.
- 07Student, class, timetable (with clash checks), holiday and record management, including manual correction.
- 08Recap export to Excel and PDF using the on-screen filters.
- 09Student portal with monthly history, timetable and profile.
- 10REST API with Sanctum token abilities for admin and student clients, plus an activity log.
Technical notes
- Defaults
- Radius 100 m, 15-minute tolerance, check-in closes at 12:00
- Check-in API
- POST /api/siswa/presensi { latitude, longitude } — check-in or check-out decided by the server
- Schedule
- php artisan rekap:alpa, daily at 23:59