Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the Laravel Bootcamp, where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, Laracasts can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Partners program.
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
The Laravel framework is open-sourced software licensed under the MIT license.
A comprehensive veterinary care management system built with Laravel, featuring appointment booking, doctor management, and pet care tracking.
- π Authentication & Authorization (Sanctum + Spatie Permissions)
- π¨ββοΈ Doctor Management with specializations and working hours
- π Pet Management with owner relationships
- π Advanced Appointment Booking System
- ποΈ Calendar Integration with availability checking
- π₯ Medical History Tracking with diagnoses, treatments, and documents
- π° Comprehensive Billing System with service-based pricing and payment processing
- π₯π° Automatic Treatment Billing with instant invoice generation for payable treatments
- π Comprehensive API with clean architecture
The appointment system is designed with flexibility in mind, supporting multiple booking workflows to accommodate different user preferences.
Perfect for users with time constraints
User Journey: "I can only come at 2:00 PM on Friday - who's available?"
User selects time β System shows available doctors β User picks doctor β Books appointment
API Flow:
GET /api/available-doctors?date=2024-01-15&time=14:00
# Returns list of doctors available at that specific time
POST /api/appointments
# Books with selected doctor
Perfect for users with doctor preferences
User Journey: "I want to see Dr. Smith - when is she available?"
User selects doctor β System shows available times β User picks time β Books appointment
API Flow:
GET /api/calendar/1?date=2024-01-15
# Returns available time slots for Dr. Smith
POST /api/appointments
# Books at selected time
Perfect for flexible users
User Journey: "Show me everything available this week"
User browses calendar β System shows all slots β User picks doctor + time β Books appointment
API Flow:
GET /api/calendar?start_date=2024-01-15&end_date=2024-01-20
# Returns all available slots across all doctors
POST /api/appointments
# Books selected slot
This endpoint is specifically designed for time-first booking scenarios:
Purpose: Find which doctors are available for a specific time slot
When to use:
- User has a preferred time but is flexible on doctor
- Emergency appointments where any available doctor works
- Time-constrained scheduling (e.g., "I can only come during lunch break")
Example Response:
{
"data": {
"doctors": [
{
"id": 1,
"name": "Dr. Sarah Smith",
"specialization": "General Veterinarian",
"slot": {
"start": "14:00",
"end": "14:20",
"date": "2024-01-15"
}
}
],
"total_available": 1
}
}
Endpoint | Purpose | Returns | Best For |
---|---|---|---|
GET /calendar |
Browse all availability | All slots for all doctors | Calendar view, general browsing |
GET /available-doctors |
Time-first booking | Available doctors for specific time | "I want 2PM Friday - who's free?" |
GET /calendar/{doctor} |
Doctor-first booking | Available times for specific doctor | "I want Dr. Smith - when is she free?" |
- β Pet Ownership Validation: Users can only book for their own pets
- β Time Availability: No double-booking, respects doctor schedules
- β Working Hours: Appointments only during doctor's working hours
- β Future Booking: No past-date appointments
- β Conflict Prevention: Automatic overlap detection
The VetCare application includes a comprehensive billing system for service-based veterinary billing, invoice generation, and payment processing.
- Flexible Pricing: Fixed, variable, and range-based pricing models
- Service Categories: Consultation, diagnostic, treatment, surgery, vaccination, grooming, emergency
- Equipment Tracking: Required equipment for each service
- Duration Estimates: Service time planning for scheduling
- Automatic Numbering: Sequential invoice numbers (INV-YYYY-MM-NNNN)
- Multi-Item Support: Multiple services per invoice
- Tax Calculations: Configurable tax rates
- Discount System: Percentage or fixed amount discounts
- Status Tracking: Complete invoice lifecycle management
- Multiple Methods: Cash, credit/debit cards, bank transfer, online payment, check, mobile payment, insurance
- Partial Payments: Support for installment payments
- Refund Processing: Full and partial refunds with tracking
- Fee Tracking: Processing fees and gateway charges
- Payment History: Complete audit trail
- Admin: Full system access, statistics, bulk operations
- Doctor: Own invoices and patient billing
- Pet Owner: View own invoices, payment history, online payments
# Public Service Browsing
GET /api/services # Browse available services
GET /api/services/{service} # Service details
GET /api/services/category/{category} # Services by category
# Admin Billing Management
POST /api/admin/services # Create service
GET /api/admin/invoices # List all invoices
POST /api/admin/invoices # Create invoice
GET /api/admin/payments # List all payments
POST /api/admin/payments # Process payment
# Doctor Billing
GET /api/doctor/invoices # Doctor's invoices
POST /api/doctor/invoices # Create invoice
GET /api/doctor/invoices/statistics # Doctor's billing stats
# Pet Owner Billing
GET /api/my/invoices # User's invoices
GET /api/my/invoices/summary # Invoice summary
GET /api/my/invoices/overdue # Overdue invoices
POST /api/my/payments/online # Online payment
# 1. Browse available services
GET /api/services
# 2. Create invoice (Admin/Doctor)
POST /api/admin/invoices
{
"pet_id": 1,
"owner_id": 1,
"items": [
{
"service_id": 1,
"quantity": 1,
"unit_price": 75.00
}
]
}
# 3. Process payment (Pet Owner)
POST /api/my/payments/online
{
"invoice_id": 1,
"amount": 75.00,
"payment_token": "stripe_token_here"
}
The billing system includes four main tables:
services
: Billable veterinary services with flexible pricinginvoices
: Billing documents with comprehensive financial trackinginvoice_items
: Individual services on each invoicepayments
: Payment records with multiple method support
For detailed documentation, see docs/BILLING_SYSTEM.md
The VetCare application now includes automatic invoice generation when payable treatments are added to medical records. This seamlessly integrates medical care with billing.
- β Auto-Invoice Creation: Invoices generated automatically when treatments with costs are added
- β Smart Service Mapping: Treatments automatically mapped to billing services
- β Real-time Updates: Invoice amounts update when treatment costs change
- β Payment Protection: Prevents changes to paid treatments
- π Seamless Integration: Medical records and billing work together
- π·οΈ Billing Code Support: Link treatments to existing services via billing codes
- π Comprehensive Tracking: Full audit trail of treatment billing
- π‘ Smart Defaults: Automatic service creation for new treatment types
# Create treatment with automatic billing
POST /api/doctor/treatments
{
"medical_record_id": 1,
"type": "medication",
"name": "Antibiotics",
"cost": 45.00, # This triggers automatic invoice creation
"billing_code": "MED-001"
}
# Response includes billing information
{
"data": {
"treatment": { ... },
"billing_info": {
"invoice_id": 123,
"invoice_number": "INV-2024-01-0001",
"amount": 45.00,
"is_billed": true
},
"message": "Treatment created and invoice generated automatically"
}
}
# List treatments with billing status
GET /api/doctor/treatments
# Get treatment statistics including billing
GET /api/admin/treatments/statistics
// Create treatment with automatic billing notification
const createTreatment = async (treatmentData) => {
const response = await fetch('/api/doctor/treatments', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
medical_record_id: treatmentData.medicalRecordId,
type: treatmentData.type,
name: treatmentData.name,
cost: treatmentData.cost, // Triggers automatic billing
start_date: treatmentData.startDate
})
});
const result = await response.json();
// Show billing notification if invoice was created
if (result.data.billing_info) {
showNotification(
`Invoice ${result.data.billing_info.invoice_number} created automatically for $${result.data.billing_info.amount}`
);
}
return result;
};
- Automatic Billing: Only treatments with
cost > 0
trigger invoice creation - Payment Protection: Cannot modify/delete treatments that have been paid
- Service Integration: Automatically creates or links to billing services
- Audit Trail: Complete logging of all automatic billing actions
For complete documentation, see docs/TREATMENT_BILLING.md
- PHP 8.1+
- Composer
- Laravel 10+
- MySQL/SQLite
- Clone the repository
git clone <repository-url>
cd vetcare-laravel
- Install dependencies
composer install
- Environment setup
cp .env.example .env
php artisan key:generate
- Database setup
php artisan migrate
- Seed sample data
# Full dataset (recommended for development)
php artisan db:seed
# OR quick test data (minimal dataset)
php artisan db:seed --class=QuickTestSeeder
After seeding, you'll have:
Full Seeding:
- 1 Admin user (
admin@vetcare.com
) - 10 Regular users
- 8 Doctors with various specializations
- 20+ Pets with realistic data
- 30+ Appointments across different statuses
- Doctor availability restrictions
Quick Test Seeding:
- 1 Admin (
admin@test.com
) - 3 Regular users
- 3 Doctors (
doctor1@test.com
,doctor2@test.com
,doctor3@test.com
) - 6 Pets (2 per user)
- 10 Appointments
- Some doctor restrictions
Default Password: password
for all users
Comprehensive API documentation is available in docs/APPOINTMENT_API.md
# Authentication
POST /api/auth/login
POST /api/auth/register
# Calendar & Availability
GET /api/calendar # Browse all availability
GET /api/available-doctors # Time-first booking
GET /api/calendar/{doctor} # Doctor-first booking
# Appointment Management
POST /api/appointments # Book appointment
GET /api/appointments # List user appointments
GET /api/appointments/{id} # Get specific appointment
PUT /api/appointments/{id} # Update appointment
PATCH /api/appointments/{id}/cancel # Cancel appointment
# Utility
GET /api/appointments/upcoming/list # Upcoming appointments
GET /api/appointments/history/list # Appointment history
- Data Layer: Spatie Laravel Data for type-safe DTOs
- Service Layer: Business logic separation
- Controller Layer: HTTP request handling only
- Model Layer: Eloquent relationships and scopes
app/
βββ Data/Appointments/ # DTOs with validation
β βββ BookAppointmentData.php
β βββ UpdateAppointmentData.php
β βββ AppointmentResource.php
βββ Services/ # Business logic
β βββ AppointmentBookingService.php
β βββ AppointmentCalendarService.php
β βββ DoctorAvailabilityService.php
βββ Http/Controllers/ # API endpoints
β βββ AppointmentController.php
βββ Models/ # Eloquent models
βββ Appointment.php
βββ Doctor.php
βββ Pet.php
- Login as a user:
POST /api/auth/login
{
"email": "user@example.com",
"password": "password"
}
- Check calendar availability:
GET /api/calendar?start_date=2024-01-15&end_date=2024-01-20
- Find available doctors for specific time:
GET /api/available-doctors?date=2024-01-15&time=09:00
- Book an appointment:
POST /api/appointments
{
"doctor_id": 1,
"pet_id": 1,
"date": "2024-01-15",
"time": "09:00",
"appointment_type": "regular",
"duration": 30,
"notes": "Regular checkup"
}
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is open-sourced software licensed under the MIT license.
The appointment system provides maximum flexibility for UI/UX design:
- Time-picker first β Use
/available-doctors
- Doctor-picker first β Use
/calendar/{doctor}
- Calendar view β Use
/calendar
All endpoints return consistent JSON responses with proper error handling. See docs/APPOINTMENT_API.md
for complete implementation examples.