Entry point
POST /api/auth/register → RegisterController → RegistrationService::register()
File: app/Models/Services/RegistrationService.php
Registration flow
Validate input
- Email: unique, valid format
- Password: minimum 6 characters
- Username: validated via
UsernameService(5-20 chars, starts with letter, alphanumeric only)
Create user
Creates user record with:
firstname,lastname,email,password(hashed)country_id— from request or defaults to GBrole_id— TUTOR (1), STUDENT (2), or PARENT (3)username— validated unique
Set personal details
- Creates
PersonalDetailwith date of birth - Associates profile picture (moves from temp storage to permanent S3 location)
- Associates address if provided
- Associates mobile number if provided
Tutor-specific setup
If the user is a tutor:
- DBS association — links DBS document if provided
- Payment card — adds Stripe payment method via
StripeService::createCard() - Subscription — creates Stripe subscription via
SubscriptionService::subscribe()
Fire events
Fires the
Registered event, which triggers three listeners:SendVerificationEmail— sends email verification link (6-hour expiry)SendNewAccountCreatedEmail— notifieshello@tutorbloc.com(production only)SendNewTutorAccountCreatedEmail— notifies internal team (production + staging, tutors only)
Tutor profile completion
After registration, tutors must complete a 4-step profile before becoming visible:User::getProfileCompletionPercentage().
Full visibility requirements
A tutor becomes searchable (is_visible = true) only when ALL of these are true:
| Requirement | Check method |
|---|---|
| Profile picture uploaded | hasProfilePicture() |
| Video uploaded | hasVideo() |
| Bio written (max 500 chars) | hasBio() |
| Primary address set | hasPrimaryAddress() |
| Mobile number verified | hasMobileNumber() |
| At least one subject taught | hasTaughtSubjects() |
| Valid availability set | hasValidAvailability() |
| Identity verification passed | hasPassedVerification() |
| Valid qualification or education | hasValidQualification() or hasValidEducation() |
| Valid DBS check | hasValidDBS() |
| Active subscription | hasValidSubscription() |
Profile completion notification
TheSendTutorProfileCompletionNotification job runs daily at 10:00 UTC. It targets tutors created 3 days ago with incomplete profiles and sends a push notification nudge.
Login flow
POST /api/auth/login → LoginController → SessionService::createSession()
- Validates credentials via
Auth::guard()->retrieveByCredentials() - Generates token:
md5(uniqid($userId, true)) - Stores token in Redis (1-year expiry)
- Creates
Sessionrecord in database - Returns token to client
Password reset
POST /api/auth/forgot → ForgotPasswordController
Sends ResetPassword notification with a signed token (6-minute expiry).
Account deletion
DELETE /api/auth → requires auth:api
Soft-deletes the user. Sends UserDeleted email to hello@tutorbloc.com.