Welcome to the Company Portal (DTR System)—a comprehensive workforce management solution built on Laravel 10.x. This system unifies Human Resources Management, Attendance Tracking (DTR), Workforce Scheduling, Leave & Overtime Management, and Single Sign-On (SSO) authentication into a single, production-ready platform.
To reduce administrative overhead by 40% through full automation of attendance tracking, leave management, and employee data centralization while maintaining compliance with Philippine labor laws (RA 10151, BIR, SSS, PhilHealth).
Note: Payroll processing module (Gross Pay Calculation, Deductions, Payslip Generation) is scheduled for Phase 2 (Q1-Q2 2025) development.
The application follows a strict MVC (Model-View-Controller) pattern with event-driven job queues and middleware protection. This ensures scalability, maintainability, and security across all layers.
┌────────────────────────────────────────────────────────────────┐
│ Presentation Layer │
│ (Blade Views, DaisyUI Components, Tailwind CSS) │
│ │
│ - Dashboard (Admin, HR, Employee, Team Lead) │
│ - CRUD Forms (Users, Employees, Leaves, etc) │
│ - Modal Dialogs (Approvals, Confirmations) │
│ - Reports (Charts, Tables, Exports) │
│ - Calendar Views (DTR, Shifts, Leaves) │
└────────────────────────┬─────────────────────────────────────┘
│
┌────────────────────────▼─────────────────────────────────────┐
│ Application/Business Logic Layer │
│ (Laravel Controllers & Services) │
│ │
│ Admin/ Web/ API/ │
│ - Dashboard - Home - SSOController │
│ - Users - DTR - AdminAPI │
│ - Roles - Leaves - V1 APIs │
│ - Schedules - Overtime │
│ - SSO Clients - Holidays │
│ - Activities - Notifications │
│ - Approvers - Calendars │
└────────────────────────┬─────────────────────────────────────┘
│
┌────────────────────────▼─────────────────────────────────────┐
│ Data Access Layer │
│ (Eloquent ORM, Models, Policies) │
│ │
│ - User Model - Leave Request Model │
│ - Employee Model - Overtime Model │
│ - DTR Record Model - Holiday Model │
│ - Schedule Model - Shift Model │
│ - SSO Client Model - Role & Permission Models │
│ - Activity Log Model - Notification Model │
└────────────────────────┬─────────────────────────────────────┘
│
┌────────────────────────▼─────────────────────────────────────┐
│ Data Layer │
│ (MySQL Database + Redis Cache + Queue) │
│ │
│ - Persistent Data (MySQL 8.0+) │
│ - Session Cache (Redis 6.x+) │
│ - Job Queue (Redis Queue) │
│ - Rate Limiting Cache │
└────────────────────────────────────────────────────────────────┘
| Pattern | Purpose | Example |
|---|---|---|
| MVC | Separation of concerns | Controller → Model → View |
| Service Layer | Business logic encapsulation | DTRService, LeaveService |
| Observer/Event | Trigger actions on model events | LeaveRequested, OvertimeApproved |
| Policy-Based | Authorization rules per resource | LeaveRequestPolicy |
| Factory | Create complex objects | UserFactory (testing) |
| Repository | Data access abstraction | UserRepository |
We utilize a modern, LTS (Long Term Support) focused stack to ensure security and maintainability.
| Layer | Technology | Version | Purpose |
|---|---|---|---|
| Backend | Laravel | 10.x+ | Core PHP framework (routing, ORM, jobs) |
| Frontend | Blade + Tailwind CSS | 3.0+ | Server-side template rendering |
| UI Components | DaisyUI | 3.x+ | Pre-built accessible Tailwind components |
| Database | MySQL | 8.0+ | Relational data storage |
| Cache/Queue | Redis | 6.x+ | Session store, job queue, rate limiting |
| Authentication | Laravel Sanctum + OAuth | 2.0 | API token auth + SSO |
| Laravel Mail + Mailable | - | Transaction emails (approvals, requests) | |
| File Storage | Local / AWS S3 | - | Document uploads, file management |
| JavaScript | Alpine.js + Chart.js | - | Interactivity (modals, charts, calendars) |
| Export | Laravel Excel | - | XLSX/CSV reports (Activity Logs, etc) |
Each user role has a tailored dashboard reflecting their responsibilities:
Web/Admin/DashboardController)Web/Employee/DashboardController)Web/HR/DashboardController)Web/Tl/DashboardController)Location-aware attendance validation using the Haversine formula.
Web/Admin/DTRController - Admin management & manual entriesWeb/Employee/AttendanceController - Employee clock-in/outWeb/HR/AttendanceController - HR oversight & approvalsWeb/Tl/AttendanceController - Team lead attendance managementAPI/V1/SSOController - API-based DTR (mobile integration)┌──────────────────────────────────┐
│ User Clock-In Request │
│ (Latitude, Longitude, Timestamp) │
└────────────┬─────────────────────┘
│
┌──────▼──────────────┐
│ Calculate Distance │
│ (Haversine Formula) │
│ Office: 14.5994°N, │
│ 120.9842°E │
└──────┬──────────────┘
│
┌──────▼────────────────────┐
│ Check Business Rules: │
│ - Within office hours? │
│ - Already clocked in? │
│ - On approved schedule? │
│ - Not on approved leave? │
└──────┬────────────────────┘
│
┌────────▼─────────────────────┐
│ Status Determination: │
│ │
│ IF d ≤ 50m → APPROVED │
│ IF d > 50m → REMOTE │
│ (Manual review) │
└────────┬─────────────────────┘
│
┌─────────▼────────────────────┐
│ Store DTR Record │
│ + Audit Log Entry │
│ + Send Notification │
└──────────────────────────────┘
| Status | Distance | Action | Impact |
|---|---|---|---|
| Approved | ≤ 50m | Auto-approved | Count as attendance |
| Remote | > 50m | Flagged for review | Pending approval |
Web/Admin/LeaveRequestController - Admin managementWeb/HR/LeaveRequestController - HR approval workflowWeb/Employee/LeaveRequestController - Employee requestsWeb/Tl/LeaveRequestController - Team lead approvalsWeb/Admin/OvertimeController - Admin managementWeb/HR/OvertimeController - HR approval & monitoringWeb/Employee/OvertimeController - Employee requestsWeb/Tl/OvertimeController - Team lead approvalsWeb/Admin/ScheduleController - Schedule managementWeb/Admin/ShiftController - Shift definitionsWeb/Tl/ScheduleController - Team lead schedulingWeb/Employee/ShiftController - Employee viewWeb/Tl/UserScheduleController - Team member assignmentWeb/HR/HolidayController - Holiday managementWeb/CalendarEventController - Event calendarWeb/Employee/CalendarController - Employee calendar viewWeb/Admin/SSOClientController - Client CRUD, secret regenerationAPI/V1/SSOController - OAuth 2.0 endpointsApi/Admin/DashboardController - SSO analyticsUser Portal SSO Server Integrated App
│ │ │
├─ Click Login ──────────>│ │
│ │ │
│ ├─ Generate Code ─────────>│
│ │ │
│<─────────────────────────────────────────────────┤
│ Redirect with Code │
│ │ │
│ │<─ Exchange Code ────────│
│ │ for Access Token │
│ │ │
│ ├─ Validate Token ────────>│
│ │ │
│<────────Session Created────────────────────────┤
Web/Admin/UserController - User CRUD operationsWeb/Admin/ProfileController - Admin user profilesWeb/Employee/ProfileController - Employee self-service profilesWeb/Admin/RoleController - Role management & permissionsWeb/Admin/ApproverController - Approver hierarchy setupWeb/Admin/ActivityLogController - Complete log viewerWeb/Admin/NotificationController - Notification managementWeb/Employee/NotificationController - Employee notificationsImpersonateUserController)Web/Admin/WorkPlaceController - Workplace/office setupWeb/Admin/WorkStationController - Workstation managementWeb/Tl/WorkPlaceController - Team lead viewThe system implements Role-Based Access Control (RBAC) with Laravel Policies governing all resource access.
| Role | Module Access | Key Responsibilities |
|---|---|---|
| Admin | All modules | System config, user management, approvals |
| HR | Leaves, Overtime, Holidays, Approvals, Reports | Approve leaves/OT, manage policies, reports |
| Employee | Own DTR, Leave requests, View payslip (future) | Clock in/out, request leave/OT, self-service |
| Team Lead | Own team's DTR, approvals, schedule | Approve team leaves/OT, manage shifts, staff |
| Finance | Payroll view (future), reports | Monitor payroll, generate reports |
// Example: LeaveRequestPolicy
public function approve(User $user, LeaveRequest $request)
{
return $user->hasRole(['admin', 'hr', 'team_lead']);
}
public function create(User $user)
{
return $user->hasRole(['admin', 'employee', 'team_lead']);
}
The system exposes a RESTful API for mobile and third-party integrations using OAuth 2.0 token authentication.
/api/
├── v1/
│ ├── /sso/authorize (POST) - Initiate OAuth
│ ├── /sso/token (POST) - Exchange code for token
│ ├── /sso/refresh (POST) - Refresh access token
│ ├── /dtr/clock-in (POST) - Clock in with location
│ ├── /dtr/clock-out (POST) - Clock out
│ ├── /dtr/history (GET) - Attendance history
│ ├── /dtr/{id} (GET) - Get specific DTR record
│ ├── /leaves (GET/POST) - Leave management
│ ├── /leaves/{id}/approve (POST) - Approve leave
│ ├── /overtime (GET/POST) - Overtime management
│ ├── /schedules (GET) - Employee schedule
│ └── /user (GET) - Current user info
│
└── admin/
├── /dashboard (GET) - System statistics
├── /users (GET/POST/PUT) - User management
├── /dtr/bulk-approve (POST) - Bulk DTR approval
├── /activities (GET) - Activity logs
└── /reports/:type (GET) - Export reports
Example: Clock-In Request
POST /api/v1/dtr/clock-in
Authorization: Bearer <access_token>
{
"latitude": 14.5994,
"longitude": 120.9842,
"timestamp": "2025-12-04T08:30:00Z",
"device_id": "mobile-123"
}
Response: Success
{
"success": true,
"message": "Clock-in approved",
"status": "APPROVED",
"distance_meters": 45.3,
"clock_in_time": "2025-12-04T08:30:15Z",
"employee": {
"id": 1,
"name": "John Doe",
"position": "Software Engineer",
"shift": "Morning (08:00-17:00)"
}
}
⚠️ Security Tip: Never commit
.envfiles or secrets to Git. Use environment managers (HashiCorp Vault, AWS Secrets Manager).
users
├── id, name, email, password, role, status,
│ last_login, created_at, updated_at
employees
├── id, user_id, employee_id, department, position,
│ hire_date, status, manager_id, created_at
dtr_records
├── id, employee_id, clock_in, clock_out,
│ latitude, longitude, status, distance, notes,
│ approved_by, approved_at, created_at
leave_requests
├── id, employee_id, type, start_date, end_date,
│ reason, status, attachment, approved_by,
│ approval_date, created_at
overtime_requests
├── id, employee_id, date, hours, reason,
│ status, approved_by, approval_date, created_at
sso_clients
├── id, name, client_id, client_secret, redirect_url,
│ icon_id, is_sso, created_at, updated_at
schedules
├── id, employee_id, shift_id, date_from, date_to,
│ status, created_at
shifts
├── id, name, start_time, end_time, description,
│ is_active, created_at
roles
├── id, name, description, permissions (JSON)
activity_logs
├── id, user_id, action, model, model_id,
│ old_values, new_values, ip_address, created_at
workplaces
├── id, name, address, latitude, longitude,
│ geofence_radius, is_active, created_at
holidays
├── id, name, date, is_special, created_at
Employee Initiates Clock-In
↓
System Calculates GPS Distance (Haversine)
↓
Validate: Within office hours? On schedule?
↓
Status: APPROVED (≤50m) or REMOTE (>50m)
↓
DTR Record Created + Audit Log
↓
Notification Sent to Employee/HR
Employee Submits Leave Request
↓
System Checks: Leave balance, overlapping dates
↓
Notification to Team Lead
↓
[TL Approval/Rejection]
↓
Notification to HR (if approved by TL)
↓
[HR Final Approval/Rejection]
↓
Leave Status Updated + DTR Auto-Blocked
↓
Email Notification to Employee
Employee Requests Overtime
↓
System Notifies Team Lead
↓
[TL Approval/Rejection]
↓
[HR Review (if approved)]
↓
Overtime Status Updated
↓
Email Confirmation to Employee
/resources/views)- dashboard.blade.php - Main portal dashboard
- welcome.blade.php - Public landing page
apps/
- index.blade.php - Application launcher grid
auth/
- login.blade.php - Login form
- register.blade.php - Registration form
- sso-login.blade.php - SSO login interface
users/
- admin/sso-clients/ - SSO client management
- admin/users/ - User management
- admin/schedules/ - Schedule management
- admin/dtr/ - DTR admin panel
- employee/ - Employee portal
- hr/ - HR functions
- tl/ - Team lead functions
components/
- badge.blade.php - Status badges
- calendar.blade.php - Calendar widget
- chart.blade.php - Chart components
- modal.blade.php - Modal dialogs
- notification-message.blade.php - Alert messages
- table.blade.php - Data table
emails/
- leaverequest.blade.php - Leave notification email
- overtimerequest.blade.php - Overtime notification
- approval.blade.php - Approval notifications
docs/sso/ - SSO documentation
/app/Http/Controllers)Admin/
├── ActivityLogController - Audit trail management
├── ApproverController - Approver chain setup
├── AttendanceController - Attendance admin
├── DashboardController - Admin dashboard
├── DTRController - DTR admin panel
├── LeaveRequestController - Leave approvals
├── NotificationController - Notification management
├── OvertimeController - Overtime management
├── ProfileController - User profiles
├── RoleController - Role management
├── ScheduleController - Schedule management
├── ShiftController - Shift management
├── SSOClientController - OAuth client mgmt
├── UserController - User CRUD
├── UserShiftController - Shift assignments
├── WorkPlaceController - Office management
└── WorkStationController - Workstation mgmt
Web/
├── Admin/* - Admin panel controllers
├── Employee/* - Employee portal
├── HR/* - HR functions
├── Tl/* - Team lead functions
├── HomeController - Home/dashboard
├── CalendarEventController - Calendar events
└── GeneralHolidayController - Holiday management
API/
├── V1/SSOController - OAuth endpoints
└── Admin/DashboardController - API statistics
/resources/docs/1.0//docs/api (built-in)Payroll Module Status: The payroll processing engine (gross pay calculation, deduction processing, payslip generation) is NOT YET IMPLEMENTED and is scheduled for Phase 2 development (Q1-Q2 2025). Current version focuses on attendance tracking and leave/overtime management.
| Version | Date | Changes |
|---|---|---|
| 1.0 | Dec 2025 | Phase 1 Complete (DTR, Leave, OT, SSO) |
Last Updated: December 4, 2025
Version: 1.0.0
Status: 🟢 Production Ready (Phase 1)
Maintainer: DevOps & Engineering Team
License: Proprietary - All Rights Reserved