Automated Graphics – College RSVP Graphics

This subsystem automatically generates branded social-media graphics whenever a college coach RSVPs to an event. These graphics are stored in S3, associated with the college, and surfaced in the Prep Network dashboards for manual review or posting to social channels.

1. Event Configuration

Each event may include an RSVP template image used as the base for graphics.

  • The rsvp_template field is stored on the events table via migration 2025_04_22 (add_rsvp_template_to_events_table) and managed in the Event Settings UI .

  • In the Settings form, a document‐upload component handles image selection:

    <x-document-upload name="rsvp_template" id="rsvp_template"
       :value="$event->rsvp_template ?? ''" />
    

2. Trigger & Routing

When a college record exists and has a logo plus an uploaded RSVP template, the dashboard shows a Generate button:

Condition Action
$college->graphic exists View existing graphic via <a href="{{ $college->graphic->url }}">…
$college->logo && $event->rsvp_template present Link to colleges.generateGraphic to dispatch sync job for graphic generation

Routes in routes/events.php include:

Route::get('colleges/{college}/generate-graphic', 
    [CollegeController::class, 'generateGraphic'])
    ->name('colleges.generateGraphic');

3. CollegeController::generateGraphic

This controller method handles manual and automated invocation:

public function generateGraphic(College $college, Request $request)
{
    // Optionally update external ID
    if ($value = $request->get('value')) {
        $college->prepnetwork_id = $value;
        $college->save();
    }
    // Dispatch graphic generation job synchronously
    GenerateCollegeRsvpGraphic::dispatchSync($college);
    return redirect()->back()->with('message', 'Graphic generated successfully');
}
  • dispatchSync ensures immediate generation and availability.
  • On success, the graphic URL becomes accessible via $college->graphic->url.

4. GenerateCollegeRsvpGraphic Job

This queued job (in app/Jobs/GenerateCollegeRsvpGraphic.php) encapsulates:

  • Data Gathering: Loads College, its Event, and the RSVP template URL ($college->event->rsvp_template).
  • Image Composition:
    • Uses Intervention/Image to open the template.
    • Inserts the college’s logo, name, division, and other details at configured coordinates.
    • Applies text styling (fonts, colors) consistent with website branding (e.g., $event->website->color).
  • Storage: Streams the final image to S3 under event-images/rsvp-graphics/college-{id}.png.
  • Persistence:
    • Attaches the resulting S3 URL to the college via a polymorphic S3Image record.
    • Allows retrieval through $college->graphic.

See the similar pattern in the “GenerateGraphics” command for attendees, which writes to social-graphics and emails on completion .

5. Graphic Model & Retrieval

  • MorphMany Relation on College (images()): stores multiple graphics per model.
  • $college->graphic returns the latest graphic.
  • Display in Blade:
    @if ($college->graphic)
      <img src="{{ $college->graphic->url }}" alt="RSVP Graphic">
    @endif
    

6. Dashboard Integration

  • In Event → Colleges list (resources/views/dashboard/events/partials/overview.blade.php), each row includes:
    • Eye icon to view the graphic.
    • Change Logo dropdown to re-trigger generation with a different college’s logo .
  • Loading State: Inline spinner disables the button during processing.

7. Dependencies & Tools

  • Laravel Jobs & Queues
  • Intervention/Image ("intervention/image") for image manipulation.
  • AWS S3 via Flysystem ("league/flysystem-aws-s3-v3").
  • Blade Views and Livewire for UI.
  • Prep Network color and font constants for branding consistency.

8. Design Decisions

  • Synchronous Dispatch simplifies immediate feedback in the UI.
  • Polymorphic Images allow flexible attachment of social graphics to any model.
  • Template-based approach centralizes design outside code; event managers can upload new templates without deployments.
  • graphics:generate (Console) for bulk attendee graphic regeneration .
  • Regenerate Graphics button under Marketing tab triggers similar logic for event assets.

Key Classes & Files

Component Responsibility
CollegeController@generateGraphic Endpoint to dispatch RSVP graphic job
GenerateCollegeRsvpGraphic (Job) Business logic for image composition and S3 saving
Event Settings form Upload rsvp_template via S3 and store URL
Pick Logo dropdown partial UI to replace college logo and re-generate graphic
S3Image model (morphMany) Persists graphic metadata and URL

Note: Social channel posting (e.g., Twitter, Instagram) is handled downstream via separate operational tooling and manual scheduling once graphics exist.