Skip to content
All projects

Case study

Leave Management Module

Leave requests and approvals for a company intranet. It tracks each person's days, refuses overlapping requests, and stops approvers signing off their own leave.

Role
Full-stack developer: domain model, persistence, UI and notifications
Stack
Laravel, PHP, Inertia, React
Key decision
Balances are never stored: they are always summed from requests, so rejecting or cancelling a request frees the days with no compensating write

Problem

Leave requests needed rules a spreadsheet can't enforce: who is entitled to how many days, whether a request fits the remaining quota, whether it overlaps another, and who is allowed to approve it.

Approach

Built in four phases. First a UI shell on real routes and validation, with queries returning fixed data, so the frontend was written against the final data shapes. Then persistence: tables, domain actions, an authorization policy and quota enforcement. Then attachment upload and carry-forward of unused annual leave. Last, a generic in-app notifications module that tells approvers about new requests and requesters about decisions.

Outcome

Merged into the intranet, with notifications deployed to staging. The domain rules are covered by 39 feature tests, and the notification flows have their own tests. The notification module is generic, so other modules can reuse it.

Highlights

  • Balances are never stored: they are always summed from requests, so rejecting or cancelling a request frees the days with no compensating write
  • Org-wide rather than team-scoped, and leave-type rules (quota, attachment required, carry-forward, maximum length) live on the leave-type enum, so adding a type is a code change, not a migration
  • Enforced rules: weekends don't count against the balance, pending leave counts against it, overlapping requests are refused, approvers can't review their own requests, and approved leave can be cancelled only before it starts
  • Attachment upload, carry-forward automation, and an entitlement admin that can't set days below what is already used
  • Generic notifications: feed, unread count, mark-read and mark-all-read, scheduled pruning of read notifications

Want something like this built?

Tell me what you need; you get a fixed quote after a short call.