The essential five
User model
app/Models/v1/User.phpThe central model — every feature touches it. Understand:- All 30+ relationships (
hasMany,belongsTo,hasOne,belongsToMany) - The extensive query scopes (
withBasicInfo,isAvailableOnDate,isVisible,whoTeaches,withDistance, etc.) - Profile completion logic:
getProfileCompletionPercentage(),isVerified(),isProfileComplete() - Verification checks:
hasPassedVerification(),hasValidQualification(),hasValidDBS() - The
Tutormodel (app/Models/Tutor.php) extends User viaHasParenttrait with aTutorScopeglobal scope
Lesson + Booking models
app/Models/v1/Lesson.php + app/Models/v1/Booking.phpThe core domain pair. Understand:- Lesson states:
ACTIVE (1),RESCHEDULE (2),CANCELLED (0) - Booking states:
AWAITING_PAYMENT (3)→REQUIRES_CAPTURE (5)→PAYED (1)→REFUNDED (0)/PARTIAL_REFUNDED (4) - The
store(),reschedule(),approveRescheduledLesson(),cancel()methods on Lesson - How Booking links a Lesson to a User with a PaymentReceipt
- The 72-hour reschedule rule
- Soft deletes on both models
StripeService
app/Models/Services/Payments/StripeService.phpThe payment engine. Trace the flow:createCustomer()— creates Stripe customer, links to PaymentAccountcreateCard()— validates and attaches payment methodcreateCharge()— creates PaymentIntent with manual capture, handles 3D SecurecreateReceipt()— records payment receipt with commission breakdowncreatePayout()— transfers funds to tutor via Stripe Connectrefund()— full or partial refund
handleSubscriptionWebhook() for processing Stripe webhook events.Routes + WebAPI middleware
routes/api.php + app/Http/Middleware/WebAPI.phpHow requests flow in:routes/api.php— current API routes under/api/*routes/legacy-api.php— v1 routes under/api/v1/*- The
WebAPImiddleware is critical — it implements hybrid auth: existing Auth::user() OR signed URL OR encrypted user ID as “secret” - Understand which endpoints use
auth:apivsweb.apivsinternalvs public access
RegistrationService
app/Models/Services/RegistrationService.phpThe complete registration flow. Shows how all pieces wire together:- User creation with role, country
- DOB, profile picture, address, mobile number setup
- For tutors: DBS association, payment card, Stripe subscription
- File handling: moves from temp storage to permanent
- Fires
Registeredevent → triggers email verification + internal notifications
After the essentials
Once you’ve read the five above, explore these next:SearchService
app/Models/Services/v1/SearchService.php — complex tutor search with multiple filter scopesAvailabilityService
app/Models/Services/v1/AvailabilityService.php — availability calculation with calendar conflicts and travel timeScheduled jobs
app/Console/Kernel.php — 9 scheduled jobs that run the background operationsTransformers
app/Models/Transformers/v1/ — 15 transformer classes that format API responses