Leave Requests
Leave Requests are the core of the leave management workflow. Employees submit requests for time off, which then flow through an approval process. The system tracks the full lifecycle from submission through approval or rejection, with automatic balance updates at each step.
Submitting a Leave Requestโ
As an Employee (Portal)โ
- Navigate to Leave Requests from the sidebar.
- Click Create.
- Select the Leave Type.
- Enter the Start Date and End Date.
- Enter the number of Days (supports half-day increments, e.g., 0.5, 1.5).
- Optionally add a Reason.
- Click Save.
The Employee field is automatically set to the logged-in employee โ it does not appear on the form.
As an Administratorโ
Administrators see the same form, but with an additional Employee field to select which employee the request is for. They can also fill in the Admin Notes field (hidden from employees).
From Employee Detail Viewโ
Administrators can create leave requests directly from an employee's detail page using the Create Leave Request action. The employee is pre-filled, and an additional Is Half Day toggle is available for convenience.
Validation Rulesโ
The system enforces several validation rules when submitting or editing a leave request:
Days Validationโ
The number of days must match the date range:
- Full days: Days must equal
end_date - start_date + 1 - Half days: Days must equal
(end_date - start_date + 1) * 0.5
Any other value is rejected with an error message.
Overlap Detectionโ
The system checks for overlapping leave requests for the same employee. A request is blocked if its date range overlaps with any existing approved or pending request.
Two date ranges overlap if:
start_date_1 <= end_date_2 AND start_date_2 <= end_date_1
When editing an existing request, the overlap check excludes the current record.
Request Statusesโ
| Status | Badge | Description |
|---|---|---|
| Pending | Yellow | Awaiting approval. Balance is reserved in pending_days. |
| Approved | Green | Approved by a manager. Days moved from pending_days to used_days. |
| Rejected | Red | Rejected by a manager. Days removed from pending_days. |
| Cancelled | Gray | Cancelled by the employee or administrator. Days restored. |
Approval Workflowโ
Standard Flowโ
Employee submits request
|
Status: Pending
(pending_days increased)
|
Manager reviews request
|
+--- Approve ---> Status: Approved
| (pending_days -> used_days)
| Employee notified
|
+--- Reject -----> Status: Rejected
| (pending_days removed)
| Rejection reason recorded
| Employee notified
|
+--- (Employee) Cancel --> Status: Cancelled
(pending_days removed)
Auto-Approve Flowโ
For leave types configured for auto-approval (in Settings > Leave Management):
Employee submits request
|
Observer detects auto-approve configuration
|
Status: Approved immediately
(used_days increased)
No manager notification sent
Approval Workflow Settingsโ
Navigate to Settings > HRM Configuration > Leave Management to configure the workflow:
| Setting | Options | Default |
|---|---|---|
| Approval Workflow | Single Level / Multi Level / Auto Approve | Single Level |
| Auto-Approve Leave Types | Select specific leave types | None |
Approving a Leave Requestโ
Requires the approve leave requests permission.
- Navigate to Leave Requests or open from the pending requests dashboard card.
- Select one or more pending requests.
- Click the Approve action.
- Optionally add Admin Notes.
- Confirm.
What happens:
- Status changes to Approved
approved_byis set to the current userapproved_atis set to the current timestamp- Leave balance:
pending_daysdecreases,used_daysincreases - Employee receives a notification
Rejecting a Leave Requestโ
Requires the approve leave requests permission.
- Select one or more pending requests.
- Click the Reject action.
- Enter a Rejection Reason (required).
- Optionally add Admin Notes.
- Confirm.
What happens:
- Status changes to Rejected
rejection_reasonis recorded and visible to the employee- Leave balance:
pending_daysdecreases - Employee receives a notification
Cancelling a Leave Requestโ
Requires the cancel leave requests permission. Both employees and administrators can cancel requests.
- Select a pending or approved request.
- Click the Cancel action.
- Confirm.
What happens:
- Status changes to Cancelled
- If the request was pending:
pending_daysdecreases - If the request was approved:
used_daysdecreases (days are returned)
Only pending and approved requests can be cancelled. Rejected and already-cancelled requests cannot be cancelled.
Table Viewsโ
The leave requests list includes four pre-configured views:
| View | Filter |
|---|---|
| All Leave Requests | No filter |
| Pending Requests | Status = Pending |
| Approved Requests | Status = Approved |
| Rejected Requests | Status = Rejected |
Available Filtersโ
- Status โ Pending, Approved, Rejected, Cancelled
- Start Date โ date range
- End Date โ date range
- Days โ numeric range
Notificationsโ
The system sends email notifications at key points in the leave request lifecycle:
When a Request is Submittedโ
A notification is sent to all users who have the approve leave requests permission. The email includes:
- Employee name and email
- Leave type, start/end dates, total days
- Reason (if provided)
- Link to view the request
When a Request Status Changesโ
The employee receives a notification when their request is approved, rejected, or cancelled. The email includes:
- Leave type, dates, and total days
- New status
- Rejection reason (if rejected)
- Approver's name
- Link to view the request
Email templates can be customized from Settings > Email Accounts > Templates.
Dashboard Cardsโ
The leave management system provides three dashboard cards:
| Card | Type | Description |
|---|---|---|
| Leave Requests by Status | Pie chart | Distribution of requests across statuses |
| Leave Requests by Type | Bar chart | Count of requests grouped by leave type |
| Pending Leave Requests | Table | Latest 15 pending requests requiring action |
Approval & Rejection Workflowโ
The leave approval workflow controls how leave requests move from submission to resolution. The HRM module supports three workflow modes, configurable from the settings page.
Workflow Modesโ
Configure the workflow mode in Settings > HRM Configuration > Leave Management.
Single Level (Default)โ
The simplest workflow. One authorized user reviews and approves or rejects the request.
Employee -> Submit -> Manager/HR Approves or Rejects -> Done
Any user with the approve leave requests permission can approve or reject requests.
Multi Levelโ
Requests pass through multiple approval stages. This is suitable for organizations that require both a direct manager and HR sign-off.
Employee -> Submit -> Manager Approves -> HR Approves -> Done
Auto Approveโ
All leave requests are automatically approved on submission. No human review is needed.
Employee -> Submit -> Automatically Approved -> Done
You can combine workflow modes with the Auto-Approve Leave Types setting to auto-approve specific types (e.g., Work From Home) while requiring approval for others (e.g., Annual Leave).
Auto-Approve for Specific Leave Typesโ
Rather than auto-approving all requests, you can select specific leave types that bypass approval:
- Go to Settings > HRM Configuration > Leave Management.
- In Auto-Approve Leave Types, select the types (e.g., Work From Home, Compensatory Off).
- Save.
When an employee submits a request for an auto-approved leave type:
- The status is immediately set to Approved.
- The leave balance is updated (
used_daysincreased directly, nopending_daysstep). - No notification is sent to managers.
- The employee does not receive an approval notification (since it's instant).
Requests for non-auto-approved leave types follow the standard approval workflow regardless of this setting.
Balance Updates by Actionโ
| Action | Pending Days | Used Days | Available Days |
|---|---|---|---|
| Submit request | +days | โ | decreases |
| Approve request | -days | +days | unchanged |
| Reject request | -days | โ | increases |
| Cancel (was pending) | -days | โ | increases |
| Cancel (was approved) | โ | -days | increases |
Who Can Approveโ
Approval actions are controlled by the approve leave requests permission. This permission must be explicitly granted to a role โ it is not included in the default Employee role.
Typical roles that should have this permission:
- HR Manager
- Department Head
- Team Lead
- Any administrator role
Super administrators can always approve requests (bypassed via Gate::before).
Rejection Reasonsโ
When rejecting a leave request, a Rejection Reason is required. This reason is:
- Stored on the leave request record
- Visible to the employee in their leave request detail view
- Included in the status change notification email
Administrators can also add Admin Notes during approval or rejection. Admin notes are only visible to other administrators, never to the employee.
Cancelling a Leave Requestโ
Employees and administrators can cancel leave requests that are in Pending or Approved status. Cancellation restores the consumed or reserved leave days back to the employee's balance.
Who Can Cancelโ
Cancellation requires the cancel leave requests permission. By default, employees have this permission and can cancel their own requests.
| User | Can Cancel Own | Can Cancel Others |
|---|---|---|
| Employee | Yes (with permission) | No (data scoping prevents seeing others) |
| Administrator | Yes | Yes (if they have the permission) |
| Super Admin | Yes | Yes (bypasses all checks) |
How to Cancelโ
- Navigate to Leave Requests.
- Find the request to cancel (must be Pending or Approved).
- Click the Cancel Leave action (shown inline in the actions column).
- Confirm the cancellation.
What Happens When Cancelledโ
Cancelling a Pending Requestโ
Before: pending_days = 5, used_days = 10, available_days = 3 Cancel 2-day pending request After: pending_days = 3, used_days = 10, available_days = 5
pending_daysdecreases by the request's daysavailable_daysincreases accordingly- The request status changes to Cancelled
Cancelling an Approved Requestโ
Before: pending_days = 3, used_days = 12, available_days = 3 Cancel 2-day approved request After: pending_days = 3, used_days = 10, available_days = 5
used_daysdecreases by the request's daysavailable_daysincreases accordingly- The request status changes to Cancelled
Restrictionsโ
- Rejected requests cannot be cancelled (they're already resolved).
- Already cancelled requests cannot be cancelled again.
- The Cancel action button only appears for requests in Pending or Approved status.
Overlap Validationโ
The HRM module prevents employees from submitting leave requests that overlap with their existing approved or pending requests. This ensures accurate leave tracking and prevents double-booking of time off.
How It Worksโ
When a leave request is created or updated, the system checks for overlapping date ranges:
- Queries all leave requests for the same employee.
- Filters to only approved and pending requests (rejected and cancelled are ignored).
- When editing, excludes the current request from the check.
- Tests for overlap using the formula:
existing_start <= new_end AND new_start <= existing_end.
If an overlap is found, the request is rejected with a validation error.
Examplesโ
Blocked (Overlap)โ
| Existing Request | New Request | Result |
|---|---|---|
| Jan 10โ12 (Approved) | Jan 11โ14 | Blocked โ overlaps on Jan 11โ12 |
| Jan 15โ15 (Pending) | Jan 15โ15 | Blocked โ exact same date |
| Jan 1โ31 (Approved) | Jan 10โ10 | Blocked โ contained within existing range |
Allowed (No Overlap)โ
| Existing Request | New Request | Result |
|---|---|---|
| Jan 10โ12 (Approved) | Jan 13โ15 | Allowed โ adjacent but not overlapping |
| Jan 10โ12 (Rejected) | Jan 10โ12 | Allowed โ rejected requests are ignored |
| Jan 10โ12 (Cancelled) | Jan 10โ12 | Allowed โ cancelled requests are ignored |
Cross-Type Overlapโ
Overlap validation applies across all leave types. An employee cannot have overlapping Annual Leave and Sick Leave requests โ the dates must not conflict regardless of the leave type.
Leave Carryoverโ
Leave Carryover allows unused leave days from one fiscal year to be carried forward to the next. This feature is configurable at both the global level (settings) and the individual leave type level.
How Carryover Worksโ
At the end of each fiscal year, the system processes carryover for all employees:
- For each employee's leave balance from the ending year:
- Checks if the leave type has Carry Forward enabled.
- Calculates unused days:
total_days - used_days - pending_days. - Applies the carryover cap (the lesser of the leave type's Max Carry Forward Days and the global Max Carryover Days setting).
- Creates or updates the next year's leave balance with the Carried Forward Days.
- Carried-forward days have an expiry based on the Carryover Expiry setting.
Configurationโ
Global Settingsโ
Navigate to Settings > HRM Configuration > Leave Management:
| Setting | Default | Description |
|---|---|---|
| Carryover Enabled | Yes | Master switch for the carryover feature |
| Max Carryover Days | 10 | Global cap on carried-forward days across all leave types |
| Carryover Expiry (months) | 3 | Carried-forward days expire this many months into the new fiscal year |
Per Leave Type Settingsโ
Each leave type has its own carryover configuration:
| Field | Description |
|---|---|
| Carry Forward | Enable/disable carryover for this specific leave type |
| Max Carry Forward Days | Maximum days that can carry forward for this type |
The effective carryover cap is the lesser of the leave type limit and the global limit.
Example: Leave type allows 10 days carry forward, but global max is 5. Only 5 days will carry over.
Processing Carryoverโ
Carryover is processed automatically via a scheduled command that runs on the first day of the fiscal year start month:
php artisan hrm:process-leave-carryover
Carryover Expiry
Carried-forward days are not permanent โ they expire after a configurable period. Once expired, they are no longer counted in the available balance.