Background Jobs and Scheduled Workflows

This section describes the key scheduled jobs that drive Prep Network’s operational cadence. Laravel’s task scheduler (defined in routes/console.php) orchestrates these jobs, invoking Artisan commands and queued jobs at defined intervals to automate marketing, communications, reporting, and reminders .


Scheduler Architecture

  • Definition: Scheduled tasks live in routes/console.php via the Schedule façade.
  • Execution: php artisan schedule:run (typically via cron) triggers these tasks.
  • Monitoring & Locking: Many tasks use sentryMonitor() for observability and onOneServer() or withoutOverlapping() to prevent concurrency issues .

Key Scheduled Jobs

Command Frequency Handler/Class Purpose
marketing:campaigns everyMinute(), no overlap App\Console\Commands\MarketingCampaigns Generate & send email/text campaigns
texting:campaigns everyMinute() App\Console\Commands\SendTextingCampaigns Dispatch queued texting campaigns
events:scorecard weeklyOn(1, '7:00') App\Console\Commands\EventScorecard Build & email weekly scorecards
event:confirmAttendance weeklyOn(1, '9:00') App\Console\Commands\ConfirmAttendance Notify directors to confirm attendance
events:send-attendee-email dailyAt('8:30') App\Console\Commands\SendAttendeeEmails Email attendees purchase links
events:sendPartnerRosters weeklyOn(4, '8:00') App\Console\Commands\SendPartnerRosters Email partner rosters
app:send-venue-due-date-reminders mondays()->at('10:00') App\Console\Commands\sendVenueDueDateReminders Remind upcoming venue payments
jobs:ResendTeamRosterInvites dailyAt('10:00') App\Jobs\ResendTeamRosterInvites Re-dispatch team roster invite jobs
jobs:CacheProgramRevenue dailyAt('5:00') App\Jobs\CacheProgramRevenue Cache daily program revenue

Detailed Job Descriptions

1. Marketing Campaigns 🎯

Signature

php artisan marketing:campaigns {date?}

Location: app/Console/Commands/MarketingCampaigns.php

  • Generate Phase: Creates MarketingCampaign entries based on active automations.
  • Send Phase: Filters campaigns due for today and dispatches SendTransactionalEmail jobs in production only .

2. Texting Campaigns ✉️

Signature

php artisan texting:campaigns

Location: app/Console/Commands/SendTextingCampaigns.php

  • Queries TextingCampaign records scheduled in the past 10 min.
  • Dispatches a SendTextingCampaign job for each match .

3. Weekly Scorecards 📊

Signature

php artisan events:scorecard

Location: app/Console/Commands/EventScorecard.php

  • Calculates leadership, operations, and biz-dev metrics for the past week.
  • Compiles HTML email and sends to stakeholders .

4. Attendance Confirmation ✅

Signature

php artisan event:confirmAttendance {--date=}

Location: app/Console/Commands/ConfirmAttendance.php

  • Finds tournaments 3–4 weeks out and live.
  • Sends ConfirmAttendance notifications (email + Twilio) to program directors for unconfirmed teams .

5. Venue Due-Date Reminders 🏟️

Signature

php artisan app:send-venue-due-date-reminders {days=14}

Location: app/Console/Commands/sendVenueDueDateReminders.php

  • Identifies events whose venues have balance, deposit, or remaining balance due within the next n days.
  • Renders emails.venue-payment-reminder view and emails grouped by website .
  • Reminder layout defined in resources/views/emails/venue-payment-reminder.blade.php .

Dependencies & Design Patterns

  • Artisan Commands: Each command extends Illuminate\Console\Command, defining $signature and handle().
  • Jobs vs. Commands: Commands orchestrate logic; long-running or parallelizable tasks are offloaded to App\Jobs\*.
  • Notifications: Leverage Laravel’s Notification system (ShouldQueue) for multi-channel messaging (mail, Twilio).
  • Scheduling Helpers: onOneServer(), withoutOverlapping(), and sentryMonitor() ensure robust, observable execution in clustered environments.

Card Block: Key Takeaway

{
  "title": "Ops Automation",
  "content": "Background jobs automate marketing, communications, reporting, and reminders, ensuring smooth event operations."
}