Skip to main content

Model locations

Models live in two directories:
  • app/Models/ (root) — ~20 models including Tutor, Coupon, File, Note, Subscription, and non-Eloquent value objects
  • app/Models/v1/ — ~107 models — this is where the main domain logic lives
Most business logic is in the v1/ models. When someone says “the User model” they mean app/Models/v1/User.php.

User model

app/Models/v1/User.php — the central model. Extends Laravel’s Authenticatable, implements MustVerifyEmail, uses SoftDeletes.

Key relationships

Profile completion

Tutors go through a 4-step profile completion process. getProfileCompletionPercentage() tracks progress:
  1. Taught subjects — at least one Teach with a LessonPrice
  2. Qualifications — valid education OR valid qualification document
  3. Bank account — active PaymentAccount with linked BankAccount
  4. Identity verification — passed VerificationAccount
A tutor is fully verified (isVerified()) when they have: profile picture, bio, primary address, mobile number, taught subjects, valid availability, passed identity verification, valid qualification/education, and valid DBS.

Key query scopes

Tutor model

app/Models/Tutor.php — extends User via HasParent trait (from calebporzio/parental).
Every query through Tutor:: automatically filters to tutors only. Adds methods:
  • isVerified() — full profile + verification check
  • shouldApplyManagementFee() — first lesson of month logic
  • getAvailableLessonLocations() — based on verification status
  • isGoogleConnected() — Google Calendar status

Lesson model

app/Models/v1/Lesson.php — uses SoftDeletes and LoggableActivity trait.

States

Key methods

Auto-calculated fields

The model’s boot() method auto-calculates duration in minutes whenever start and finish are set.

Booking model

app/Models/v1/Booking.php — uses SoftDeletes and LoggableActivity.

States

Teach model

app/Models/v1/Teach.php — the tutor↔subject relationship. Uses SoftDeletes. Each Teach record has:
  • One Subject
  • Many SubjectLevels (via taught_subject_levels pivot)
  • Many ExamBoards (via taught_exam_boards pivot)
  • One LessonPrice (the tutor’s hourly rate for this subject)

Models with soft deletes

These models use SoftDeletes — queries need withTrashed() to include deleted records:
  • User, Booking, Lesson, Teach
  • Card, BankAccount, Child
  • VerificationAccount, Subscription
  • ExamBoard

Non-Eloquent value objects

Several “models” are plain PHP classes, not Eloquent: