Automated Graphics – Program Commit
When a Program signs its contract, the system automatically generates a branded commitment graphic. This graphic celebrates the program’s participation in the Prep Network tournament series and is delivered for download and social sharing.
🎯 Purpose
- Announce a program’s commitment to the upcoming season.
- Provide a ready-to-share image for social media.
- Centralize graphics generation in a repeatable, automated workflow.
Flow: Commit Graphic Generation
flowchart TD
A[Program Contract Signed] --> B[Program::generateCommitGraphic()]
B --> C{Immediate or Queued?}
C -->|Queued| D[Dispatch GenerateProgramGraphic Job]
C -->|Immediate| E[GenerateProgramGraphic::handle()]
D --> F[Upload image via S3Image]
E --> F
F --> G[Persist S3Image record]
G --> H[Display in UI tabs]
Class Diagram
classDiagram
class Program {
+getCommitGraphic(season)
+generateCommitGraphic(now, callback)
+emailGraphic(fresh)
}
class GenerateProgramGraphic {
+handle()
}
class S3Image {
+upload(file, model)
+getUrlAttribute()
}
Program --> "1..*" S3Image : morphMany
Program --> GenerateProgramGraphic : new()
GenerateProgramGraphic --> S3Image : upload()
Program Model – Key Methods
| Method | Signature | Purpose |
|---|---|---|
| getCommitGraphic | getCommitGraphic($season = null) |
Retrieves the latest commit graphic image for the given season. |
| generateCommitGraphic | generateCommitGraphic(bool $now = false, $callback = null) |
Deletes old graphics; dispatches or runs job to generate a new image; returns the new S3Image. |
| emailGraphic | emailGraphic(bool $fresh = false) |
Queues an email with the commit graphic to the program’s contact. |
Controllers & Routes
ProgramController (Web)
| Route | HTTP | Controller Method | Description |
|---|---|---|---|
/regenerate-commit-graphic/{program} |
POST | regenerateCommitGraphic(Program) |
Forces synchronous regeneration of the commit graphic. |
| (UI link) |
CoachController (Director/Coach Area)
| Route | HTTP | Controller Method | Description |
|---|---|---|---|
/director/share-commit-graphic/{program} |
GET | showShareCommitGraphic(Program) |
Opens modal to generate or preview the graphic. |
/director/share-commit-graphic/{program}/download |
GET | downloadCommitGraphic(Program) |
Streams the PNG file for download. |
UI Components
Admin Dashboard – Graphics Tab
- Displays the existing commit graphic or a placeholder.
- Offers Download & Regenerate buttons when a graphic exists.
- Fallback to generate via template if none exists.
@include('dashboard.programs.tabs.graphics')
@if ($program->getCommitGraphic())
<a href="{{ route('coach.downloadCommitGraphic', $program) }}" download>Download</a>
<form action="{{ route('programs.regenerateCommitGraphic', $program) }}" method="POST" class="ajax">
<button>Regenerate</button>
</form>
<img src="{{ $program->getCommitGraphic()->url }}" alt="Commit Graphic">
@else
<button>
<a href="{{ route('coach.showShareCommitGraphic', $program) }}">
Generate Commitment Graphic
</a>
</button>
@endif
Coach Dashboard – Graphics Partial
Mirrors the admin view for coaches, enabling direct access to share and download.
Dependencies & Configuration
- Bus: Laravel’s Bus dispatches
GenerateProgramGraphicjobs. - S3Image: Model handles upload and URL generation to AWS S3 .
- Blade Views: Bootstrap/OneUI layout for modals and tabs.
{
"title": "Commit Template",
"content": "Ensure your website’s commit_template URL is configured, or graphics will fall back to a generic image."
}
Summary
The Automated Graphics – Program Commit feature ensures every program’s commitment is celebrated with a custom graphic. It integrates tightly with the Program model, dispatches a dedicated GenerateProgramGraphic job, stores images via S3Image, and surfaces the result in both admin and coach dashboards for easy sharing and download.