Events – Types
Events in the Prep Network can be one of two types:
- showcase 🏀
- tournament 🏆
These types drive key behaviors in the backend, user interfaces, and reporting throughout the application.
1. Overview
Every Event record has a type column (string) storing either showcase or tournament.
- showcase events register individual attendees.
- tournament events register teams, with each team comprising multiple players.
Developers and the system use this property to branch logic, render appropriate UI, and enforce type-specific workflows.
2. Database & Model
2.1 Schema
The events table includes:
| Column | Type | Description |
|---|---|---|
| type | string | Either showcase or tournament. |
Migrations were generated in the initial import of the
eventsmodule.
2.2 Model Accessors
The Event model defines helper methods for type checks:
public function isShowcase(): bool
{
return $this->type === 'showcase';
}
public function isTournament(): bool
{
return $this->type === 'tournament';
}
These methods underpin conditional logic in controllers, views, and services.
3. Factory
To facilitate testing and seeding, Database\Factories\EventFactory sets up the type field and offers type states:
protected $model = Event::class;
public function definition(): array
{
// ...
'type' => $this->faker->randomElement(['tournament', 'showcase']),
// ...
}
/** Indicate a tournament event. */
public function tournament(): static
{
return $this->state(fn (array $attrs) => ['type' => 'tournament']);
}
/** Indicate a showcase event. */
public function showcase(): static
{
return $this->state(fn (array $attrs) => ['type' => 'showcase']);
}
4. Backend Logic
4.1 Conditional Counts & Revenue
In budget reports, the system sums registrations differently based on type:
$currentCount = $event->isTournament()
? $event->teams->count()
: $event->attendees->count();
$budgetedCount = $event->isTournament()
? $event->team_count_budgeted
: $event->attendee_count_budgeted;
4.2 Routes & Controllers
Some routes return only one type of data:
public function getEventsForBallerTV()
{
return Event::where('is_live', 1)
->select('id', 'title', 'start_date', 'type', 'tournament_type')
->get();
}
Controllers often branch:
if ($event->isShowcase()) {
// attendee-focused logic
} elseif ($event->isTournament()) {
// team-focused logic
}
5. Frontend & UI
5.1 Dashboard Forms
In the event edit form (resources/views/dashboard/events/partials/edit-event.blade.php), users select the type, and tournament events reveal extra fields:
| Field | Show on | Notes |
|---|---|---|
| Type | Both | Dropdown: Showcase / Tournament |
| Tournament Type | isTournament() |
Dropdown: Club / High School |
| Circuit Event? | isTournament() |
Yes / No radio |
<flux:select name="type" ...>
<flux:select.option value="showcase">Showcase</flux:select.option>
<flux:select.option value="tournament">Tournament</flux:select.option>
</flux:select>
@if($event->isTournament())
<!-- Club vs High School -->
<flux:select name="tournament_type"...>…</flux:select>
<!-- Circuit Event toggle -->
<flux:select name="circuit_event"...>…</flux:select>
@endif
5.2 Public Registration Flow
On the public checkout/RSVP page, Alpine.js uses an eventType variable to toggle sections:
<div x-data="{ eventType: '{{ $event->type }}' }">
<template x-if="eventType == 'Tournament'">
<!-- Tournament payment rules, refund policy, team registration -->
</template>
<template x-if="eventType == 'Showcase'">
<!-- Showcase packet orders -->
</template>
</div>
This ensures players in showcases get a “player registration” UI, whereas tournaments show “team registration” and refund agreements.
6. Reporting & Filtering
6.1 EventFilters
The EventFilters class supports filtering by type:
public function type($type)
{
return $this->builder->where('events.type', $type);
}
All dashboards and exports leverage this filter to narrow down to showcases or tournaments.
6.2 Reports
- Hotel Compliance Report only considers tournaments (
->where('type', 'tournament')) - Event Budget Report sums registrations per type
7. Training & Templates
7.1 Training Courses
Training courses can target specific event types via a JSON event_types column. The model scopes events accordingly:
public function events()
{
return Event::whereIn('type', $this->event_types ?? ['showcase','tournament']);
}
7.2 Ticket Templates
Similarly, TicketTemplate holds a JSON event_types list to control availability:
public function eventTypes(): Collection
{
return collect($this->event_types ?: ['Showcase', 'Tournament']);
}
8. Best Practices
- Centralize type logic in
Eventmodel viaisShowcase()/isTournament(). - Use factories’ state methods (
->showcase(),->tournament()) for clean tests. - Branch in views/controllers strictly via these helper methods.
- Filter on
**type**** column** in any query or filter pipeline. - Cast JSON columns (
event_types) where list‐based logic is needed.
Understanding and leveraging these type distinctions ensures consistent, type-specific behavior across the Prep Network platform.