How bhaveshdeveloper125/office-management works
1. What this repository is
- A Laravel 12-style PHP web application for employee attendance and leave management.
- The architecture is classic server-rendered MVC: HTTP routes → controllers → Eloquent models → Blade views, with email notifications and some authorization/business-rule hooks around the domain.
2. Primary user-facing split
- The UI is divided into two major portals:
- Admin screens under resources/views/Admin
- Employee screens under resources/views/Employee
- There is also a shared login/reset-password flow and reusable Blade components in resources/views/components.
3. Request handling boundary
- routes/web.php is the main entry point for browser traffic.
- Controllers in app/Http/Controllers map the route surface area into feature areas: employee management, attendance, leave, holidays, role management, password recovery, and per-user dashboards.
- app/Http/Middleware/AuthcheckMiddleware.php indicates a custom auth gate layered on top of the normal Laravel auth flow.
4. Core domain model
- The central business entities are:
- User
- Attendance
- Leave
- UserLeave
- Holiday
- WeeklyHoliday
- These models represent employee identity, daily attendance records, leave requests/records, holiday calendars, and recurring weekly off-days.
5. Admin subsystem
- Admin controllers and views support:
- adding/editing employees
- reviewing employee details and daily attendance
- leave approval/management
- holiday management
- role management
- password changes
- employee search
- This is the operational control plane of the app.
6. Employee subsystem
- Employee controllers and views support:
- viewing attendance summaries and statuses such as late, absent, early, overtime
- marking or reviewing attendance
- requesting leave
- viewing holidays and profile data
- checking remaining days / working days
- This is the self-service portal focused on personal records and requests.
7. Leave and attendance workflows
- Attendance and leave are the most business-critical flows and likely drive most of the data state changes.
- The presence of AttendanceObserver.php and LeaveObserver.php suggests lifecycle-driven side effects, such as updating aggregates, enforcing rules, or triggering notifications when records are created or changed.
8. Authorization and roles
- Access control is not just route-level authentication; it also includes:
- app/Policies/AttendancePolicy.php
- app/Http/Controllers/RoleController.php
- config/permission.php
- database/migrations/2025_12_25_125329_create_permission_tables.php
- This strongly suggests a permission/role subsystem for distinguishing admin and employee capabilities.
9. Email and notification boundary
- Mailables in app/Mail and matching Blade templates in resources/views/Mail cover:
- welcome email
- forgot password email
- leave request email
- leave approval email
- rejection email
- Email is a key integration point for workflow notifications, especially around account onboarding and leave approvals.
10. Business rules and configuration
- Domain-specific settings are extracted into config files such as:
- config/LeavesVars.php
- config/WeeklyHoliday.php
- These likely hold leave balance rules, expected attendance behavior, or holiday definitions that affect calculations across controllers and views.
11. Database shape and evolution
- The migration history shows the app evolved from basic users to a more complete HR-style system:
- user profile extensions
- expected working hours
- attendance table
- leave tables
- holiday tables
- permission tables
- created_by auditing fields
- This suggests a relational data model with auditability and administrative ownership metadata.
12. Presentation and component structure
- Blade components such as EmployeeMenu, SideBarMenu, EmployeePageHeader, and EmpDataFilter indicate reusable layout/navigation and filtering UI.
- The app uses Laravel Blade as the main rendering layer, with a modest asset pipeline via Vite (resources/js, resources/css, vite.config.js) and some static CSS in public/css.
13. Operational/runtime context
- Standard Laravel infrastructure is present: cache, sessions, logging, queue tables, storage directories, and database seeders.
- database/seeders/InitialData.php likely bootstraps roles, default holidays, or starter users for the system.
14. How to draw the architecture
- A useful diagram would center on three domains:
- Identity/access: users, roles, permissions, auth middleware/policies
- Attendance/leave/holiday management: the core transactional business layer
- Notifications/UI: Blade views, shared components, and mailables
- The main data flows are browser request → controller → model/database → view response, with observers and mailers branching off when leave/attendance events occur.
Main entry points: web.php Web routes · LeaveController.php Leave · AttendanceController.php Attendance · HolidayController.php Holidays
Components 31
Request Layer
HTTP entry points, middleware, and controllers.
- Web routes · Main browser entry point that dispatches to feature controllers.
routes/web.php - Auth gate · Custom authentication check layered on top of Laravel auth.
app/Http/Middleware/AuthcheckMiddleware.php - Admin home · Admin landing/dashboard controller.
app/Http/Controllers/AdminHomePageController.php - Employee home · Employee landing/dashboard controller.
app/Http/Controllers/EmployeeHomePageController.php - Employees · Admin-facing employee management, search, and profile actions.
app/Http/Controllers/Usercontroller.php - Attendance · Attendance capture, review, and summaries for admin and employees.
app/Http/Controllers/AttendanceController.php - Leave · Leave request and approval workflow controller.
app/Http/Controllers/LeaveController.php - Leave records · Per-user leave record management and balances.
app/Http/Controllers/UserLeaveController.php - Holidays · Holiday management for admin and employee views.
app/Http/Controllers/HolidayController.php - Weekly off · Recurring weekly holiday management.
app/Http/Controllers/WeeklyHolidayController.php - Roles · Role and permission administration controller.
app/Http/Controllers/RoleController.php - Password reset · Forgot-password and reset flow controller.
app/Http/Controllers/ForgotPasswordController.php
Domain & Data
Core models, observers, policies, and schema evolution.
- User · Employee identity, profile, and access anchor.
app/Models/User.php - Attendance · Daily attendance records and working-hour data.
app/Models/Attendance.php - Leave · Leave request lifecycle and status records.
app/Models/Leave.php - User leave · Leave entitlements or per-user leave tracking.
app/Models/UserLeave.php - Holiday · Calendar holiday dates.
app/Models/Holiday.php - Weekly holiday · Recurring weekly off-day configuration.
app/Models/WeeklyHoliday.php - Attendance hook · Lifecycle side effects for attendance changes.
app/Observers/AttendanceObserver.php - Leave hook · Lifecycle side effects for leave changes.
app/Observers/LeaveObserver.php - Attendance policy · Authorization rules for attendance access and actions.
app/Policies/AttendancePolicy.php - Permissions schema · Creates role and permission tables for access control.
database/migrations/2025_12_25_125329_create_permission_tables.php - Core schema · User, attendance, leave, and holiday table evolution plus auditing fields.
database/migrations/0001_01_01_000000_create_users_table.php
Presentation
Blade pages, reusable components, and mail templates.
- Admin UI · Admin portal screens for employees, attendance, leave, and holidays.
resources/views/Admin - Employee UI · Employee self-service screens for attendance, leave, holidays, and profile.
resources/views/Employee - Shared components · Reusable navigation, header, and filtering components.
resources/views/components - Mailers · Welcome, reset-password, leave request, approval, and rejection emails.
app/Mail - Mail templates · Blade templates used by notification emails.
resources/views/Mail
Config & Seed
Domain rules, framework config, and bootstrap data.
- Leave rules · Domain settings for leave calculations and balances.
config/LeavesVars.php - Weekly rules · Domain settings for weekly holiday behavior.
config/WeeklyHoliday.php - Initial data · Bootstraps starter roles, users, or holiday data.
database/seeders/InitialData.php
Connections 41
- Web routes → Auth gate: protects · Browser routes are gated by the custom auth check.
- Web routes → Admin home: dispatches · Admin landing routes resolve to the admin dashboard controller.
- Web routes → Employee home: dispatches · Employee landing routes resolve to the employee dashboard controller.
- Web routes → Employees: dispatches · Routes expose employee administration flows.
- Web routes → Attendance: dispatches · Routes expose attendance workflows.
- Web routes → Leave: dispatches · Routes expose leave request and approval workflows.
- Web routes → Holidays: dispatches · Routes expose holiday management pages and actions.
- Web routes → Roles: dispatches · Routes expose role and permission management.
- Web routes → Password reset: dispatches · Routes expose login recovery flows.
- Web routes → Weekly off: dispatches · Routes expose recurring holiday management.
- Employees → User: uses · Employee management reads and updates user records.
- Attendance → Attendance: uses · Attendance workflows persist and query attendance records.
- Leave → Leave: uses · Leave workflows operate on leave requests and approvals.
- Leave records → User leave: uses · Leave balance and entitlement logic uses per-user leave data.
- Holidays → Holiday: uses · Holiday management persists calendar holidays.
- Weekly off → Weekly holiday: uses · Weekly off-day configuration persists recurring holidays.
- Attendance → Attendance hook: triggers · Attendance lifecycle changes can trigger observer side effects.
- Leave → Leave hook: triggers · Leave lifecycle changes can trigger observer side effects.
- Attendance → Attendance policy: authorizes · Attendance actions are constrained by policy checks.
- Roles → Permissions schema: depends on · Role administration relies on the permissions schema.
- User → Core schema: defined by · User fields and audit columns evolve through migrations.
- Attendance → Core schema: defined by · Attendance table structure is created and extended by migrations.
- Leave → Core schema: defined by · Leave table structure is created and extended by migrations.
- Holiday → Core schema: defined by · Holiday table structure is created through migrations.
- Admin home → Admin UI: renders · Admin dashboard and management screens are rendered from Blade views.
- Employees → Admin UI: renders · Employee administration actions render admin portal pages.
- Attendance → Admin UI: renders · Admin attendance review screens use admin Blade templates.
- Leave → Admin UI: renders · Admin leave approval screens use admin Blade templates.
- Holidays → Admin UI: renders · Holiday management screens are rendered in the admin portal.
- Employee home → Employee UI: renders · Employee dashboard and self-service screens are rendered for employees.
- Attendance → Employee UI: renders · Employee attendance views are rendered from Blade templates.
- Leave → Employee UI: renders · Employee leave request screens are rendered from Blade templates.
- Holidays → Employee UI: renders · Employee holiday views are rendered from Blade templates.
- Employee UI → Shared components: composes · Employee and admin pages reuse shared navigation and filter components.
- Mailers → Mail templates: renders · Mailable classes use dedicated Blade email templates.
- Leave → Mailers: sends · Leave submission and approval steps emit email notifications.
- Password reset → Mailers: sends · Password recovery flow sends reset and welcome mail.
- Leave → Leave rules: reads · Leave workflow uses domain configuration for balances and rules.
- Holidays → Weekly rules: reads · Holiday logic uses recurring weekly-off configuration.
- Initial data → Permissions schema: boots · Initial data likely seeds roles and permissions.
- Initial data → Weekly holiday: boots · Initial data may seed default weekly holidays.