Don't Wake Me Up: Scheduled Reminders for Mentorship Sessions
The landing project focuses on creating a user-friendly experience. A new feature has been added to send timely reminders for scheduled mentorship sessions.
The Goal: Prompt and Prepared Participants
The primary goal of this feature is to ensure that both mentors and mentees are well-prepared and punctual for their scheduled sessions. Automated email reminders, delivered 24 hours and 1 hour before the session, help to reduce no-shows and increase engagement.
Implementation: Scheduled Tasks and Notifications
The implementation revolves around scheduled tasks that run periodically to check for upcoming sessions. These tasks identify sessions within the reminder window and trigger email notifications to the relevant participants.
// Example: Sending a reminder email
function sendSessionReminder(User $user, Session $session, string $timeBefore) {
$email = new SessionReminderEmail($session, $timeBefore);
$user->notify($email);
Log::info('Session reminder sent', ['user_id' => $user->id, 'session_id' => $session->id, 'time_before' => $timeBefore]);
}
The example above illustrates the core logic of sending reminder emails. The sendSessionReminder function constructs an email notification with session details and the time remaining before the session. This email is then dispatched to the user via the notify method.
Scheduling: Command Line and Server Guards
To ensure reliable delivery, these tasks are scheduled to run every 15 minutes using console commands. Server guards are implemented to prevent overlapping executions or simultaneous runs on multiple servers, which could lead to duplicate notifications.
Benefits: Improved Engagement and Reduced No-Shows
By providing timely reminders, this feature aims to improve overall engagement with the mentorship program and minimize the occurrence of missed sessions.