Skip to content
Nur Amin
← All projects
P-11Sistem Presensi Sekolah2025

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
Stack
  • Laravel 12
  • PHP 8.2
  • MySQL
  • Sanctum
  • Leaflet
  • Tailwind CSS
  • Alpine.js
  • Laravel Excel
  • DomPDF

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

GeoPresensi title with the admin dashboard — today’s figures, a seven-day trend and pending leave — and the student home screen on a phone with a check-in button.
FIG. 01The admin dashboard and the student portal. Real screenshots with sample data; the UI is in Indonesian.
Two phones on the check-in page: one 37 m from the school inside the circle, one 423 m away outside it, next to the three steps from browser to server-side check.
FIG. 02The map is for the student; the server recomputes the distance and decides.
A timeline: Hadir until 07:15, Terlambat until 12:00, closed after, absent marked at 23:59; holiday, leave and early check-out cases; and the admin recap with status filters.
FIG. 03One set of rules decides every status, for the web and the API alike.
The student’s leave page with a pending request, the three steps request–review–recorded, and the admin list of pending requests with approve and reject buttons.
FIG. 04Approved leave becomes Izin or Sakit records, so nobody is marked absent by mistake.
The settings page with the school point and radius on a map, the radius slider and time rules, above a diagram of the web and Sanctum API sharing one service layer.
FIG. 05Location, radius and timing are settings; the web and the API share one service layer.

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

  1. 01Check-in and check-out from the student’s phone, with a live map, distance and GPS accuracy.
  2. 02Server-side radius check (Haversine) against a school point and radius chosen on a map.
  3. 03Automatic Hadir or Terlambat from the first lesson plus a configurable tolerance, and a check-in cut-off.
  4. 04Absent marked automatically every day at 23:59; disabled on holidays.
  5. 05Leave requests with an attachment, cancellable while pending; approval writes Izin/Sakit records per day.
  6. 06Admin dashboard with today’s figures, a seven-day trend, pending leave and recent activity.
  7. 07Student, class, timetable (with clash checks), holiday and record management, including manual correction.
  8. 08Recap export to Excel and PDF using the on-screen filters.
  9. 09Student portal with monthly history, timetable and profile.
  10. 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