Events – Tournaments
Tournaments are head-to-head competitions where club or high school teams register to compete in scheduled games. Each tournament is modeled as an Event with a type of tournament and a tournament_type (club or high_school). Depending on the tournament type, only matching programs and teams may register.
Data Model 📊
- events table
type(enum): “tournament” or “showcase”tournament_type(enum): “club” or “high_school” (required whentype = tournament)
- teams table: stores all teams across websites
- event_teams pivot table
event_id,team_idprice(decimal)is_paid(boolean)registration_type(enum)deleted_at&dropped_reason(nullable)
erDiagram
EVENT ||--o{ EVENT_TEAM : has
TEAM ||--o{ EVENT_TEAM : participates
EVENT_TEAM }o--|| REGISTRATION_TYPE : type
Relationships & Key Methods 🔗
- Event
teams()→ Many-to-many withTeamviaevent_teamsisTournament()→ Boolean helper fortype === 'tournament'
- Team
events()→ Many-to-many withEventgames()→ Home/awayGamerecords for score tracking
- EventTeamRelation (custom pivot) filters out dropped teams by
deleted_at
Tournament Types 🤝
Tournaments distinguish between club and high school formats:
- Club Tournaments
- Open to programs labeled as “club.”
- Registration UI shows only club events.
- High School Tournaments
- Open to school-based programs.
- Separate pricing and packet requirements can apply.
Filtering Logic:
Event::where('type','tournament')
->where('tournament_type', $program->type)
->get();
Used in TeamController@showAssignEvents to scope available events per team .
Workflow & Controllers 🚦
EventController
- indexEventTeams (
indexEventTeams(Request, Event, ...)):
Displays registered teams, with filters for “proposed,” “expired,” and “interested.” - exposureExportEventTeams (
GET /events/{event}/exposure-export):
Exports schedule requests and team rosters to CSV . - paymentsExport (
GET /events/{event}/payments-export):
Queues a payments export job for tournament registrations. - export (
GET events/{event}/export-teams):
Downloads an Excel of all registered teams. - indexEventAttendance (
GET /events/{event_id}/attendance):
Shows check-in orders for each team.
TeamController
- showAssignEvents (
GET /teams/{team}/assign-events):
Lists upcoming tournaments matching the team’s program type for manual assignment . - postAssignEvents (
POST /teams/{team}/assign-events):
Attaches or updates pivot data (price,is_paid,registration_type) for selected events.
Routes & API Endpoints 🌐
{
"title": "List Event Teams",
"description": "Retrieve teams registered for a tournament.",
"method": "GET",
"baseUrl": "https://api.prephoops.com",
"endpoint": "/events/{event}/teams",
"pathParams": [
{ "key": "event", "value": "Event ID", "required": true }
],
"responses": {
"200": {
"description": "Success",
"body": "{ \"data\": [ { \"team_id\": 1, \"name\": \"Team A\" } ] }"
}
}
}
{
"title": "Export Teams to Exposure",
"description": "Download CSV for Exposure with schedule requests.",
"method": "GET",
"baseUrl": "https://app.prephoops.com",
"endpoint": "/events/{event}/exposure-export",
"pathParams": [
{ "key": "event", "value": "Event ID", "required": true }
],
"responses": {
"200": {
"description": "CSV file download",
"body": "binary/octet-stream"
}
}
}
{
"title": "Payments Export",
"description": "Queue and return URL for tournament payments export.",
"method": "GET",
"baseUrl": "https://app.prephoops.com",
"endpoint": "/events/{event}/payments-export",
"pathParams": [
{ "key": "event", "value": "Event ID", "required": true }
],
"responses": {
"200": {
"description": "Export job started",
"body": "{ \"success\": \"Export Started!\", \"url\": \"https://...\" }"
}
}
}
{
"title": "Download Excel of Teams",
"description": "Immediate download of all registered teams.",
"method": "GET",
"baseUrl": "https://app.prephoops.com",
"endpoint": "/events/{event}/export-teams",
"pathParams": [
{ "key": "event", "value": "Event ID", "required": true }
],
"responses": {
"200": {
"description": "XLSX file download",
"body": "binary/octet-stream"
}
}
}
Blade Views & UI 🖼️
- Edit Event: shows Tournament Type and Circuit Event fields when
isTournament(). - Dashboard – Reports: “Tournaments” panel links to Event Overview and Historical Team Count reports.
- Club Teams Table: bulk export buttons (Teams, Roster, Packet, Exposure, Payments).
Console Commands & Reporting 📈
- events:send-attendee-email
Sends daily summary of tournament registration net changes (new - dropped teams). Usesevent_teamspivot. - Automated Invoicing:
app:generate-accounts-payablefor ACH registrations, filters ontype = tournament.
Testing & Factories 🧪
- EventFactory supports a
tournament()state for seeding test data. - RegistrationTests simulate tournament checkout flows with
tournament_typeset.
Best Practices & Notes 📌
- Always set
tournament_typewhen creating a tournament event. - Use the Event–Team pivot for granular control (
price,is_paid). - Leverage
isTournament()in views and APIs to toggle between teams and attendees flows. - For club vs high school variations, ensure program types align with tournament filters.
{
"title": "Key Takeaway",
"content": "Use the tournament pivot to manage registration metadata and filter by program type."
}