Entry point
POST /api/auth/register → RegisterController → RegistrationService::register()
File: app/Models/Services/RegistrationService.php
Registration flow
1
Validate input
- Email: unique, valid format
- Password: minimum 6 characters
- Username: validated via
UsernameService(5-20 chars, starts with letter, alphanumeric only)
2
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
3
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
4
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()
5
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)
6
Create session
After registration,
SessionService::createSession() auto-logs the user in and returns a session token.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:
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.