This is a Laravel-based API for managing HR-related tasks, including employee management, department tracking, and project assignments. The API uses Laravel Sanctum for authentication.
- Requirements
- Installation
- Environment Variables
- Database Setup
- Running the Application
- Running Tests
- API Documentation
- Contributing
- License
- PHP 7.4 or higher
- Composer
- MySQL
-
Clone the repository:
git clone https://github.com/yourusername/hr-management-api.git cd hr-management-api
composer installCopy the .env.example file to .env:
cp .env.example .envUpdate the .env file with your environment settings:
- Database configuration
- Other necessary environment variables
Create a new MySQL database for your application.
php artisan migrate --seedphp artisan serveOpen your web browser and navigate to http://localhost:8000.
php artisan testPOST /api/v1/login: Login and receive an access token.POST /api/v1/logout: Logout and invalidate the access token.
GET /api/v1/employees: Get a list of all employees.POST /api/v1/employees: Create a new employee.DELETE /api/v1/employees/{employee}: Delete an employee.GET /api/v1/employees/{employee}/managers: Get the managers of an employee.GET /api/v1/employees/average-salary: Get the average salary of employees by age group.GET /api/v1/employees/top-completed-projects/{department}: Get the top 10 employees with the most completed projects in a department.GET /api/v1/employees/never-changed-department: Get employees who have never changed their department.POST /api/v1/employees/{employee}/change-department: Change the department of an employee.
GET /api/v1/departments: Get a list of all departments.POST /api/v1/departments: Create a new department.POST /api/v1/departments/{department}/assign-manager: Assign a manager to a department.
GET /api/v1/projects: Get a list of all projects.POST /api/v1/projects: Create a new project.GET /api/v1/projects/search: Search for projects by name, description, or assigned employee.GET /api/v1/projects/average-duration: Get the average duration of projects by department.