Colleges – RSVP πŸŽ“

Coaches from collegiate programs can RSVP to attend and view athletes at Prep Network events. This section covers everything from event configuration in the admin panel to the public-facing RSVP flow, including key classes, Blade views, Livewire components, routes, and database migrations.

1. Event Configuration

To enable and configure coach RSVPs for an event, the admin panel exposes several settings under College Coaches in the event edit form.

  • Allow RSVP? Toggle to enable coach RSVPs.
  • Non-D1 Price (packet_price): Standard packet price for non-Division 1 schools.
  • Early Bird Non-D1 Price (early_bird_packet_price): Discounted price if RSVPed at least one month before event start.
  • D1 Price (d1_packet_price): Optional premium price for Division 1 schools.
  • RSVP Template (rsvp_template): Upload a PDF template for the college packet.
<flux:switch name="allow_rsvp" :checked="$event->allow_rsvp" label="Allow RSVP?" />
<flux:input name="packet_price"   label="Non-D1 Price"              :value="$event->packet_price" />
<flux:input name="early_bird_packet_price" label="Early Bird Non-D1 Price" :value="$event->early_bird_packet_price" />
<flux:input name="d1_packet_price"         label="D1 Price"                 :value="$event->d1_packet_price" />
<x-document-upload name="rsvp_template"    :value="$event->rsvp_template" />

Admin UI snippet

Migrations

Two migrations extend the schema for RSVP functionality:

Migration Purpose
add_early_bird_rsvp_discount_to_events_table.php Adds early_bird_packet_price to events
add_registered_column_to_colleges_table.php Adds registered boolean to colleges
// events
Schema::table('events', function (Blueprint $t) {
    $t->decimal('early_bird_packet_price', 13, 2)->nullable()->after('packet_price');
});

// colleges
Schema::table('colleges', function (Blueprint $t) {
    $t->boolean('registered')->default(false)->after('coaches');
});

Migrations

Pricing Logic

The Event model provides helper methods:

/** Is early bird period active? */
public function isEarlyBirdRSVP(): bool {
    return Carbon::parse($this->start_date)
        ->diffInMonths(now()) > 0
        && !empty($this->early_bird_packet_price);
}

/** Get effective RSVP price by division */
public function rsvpPrice($division = ''): float {
    return $this->isEarlyBirdRSVP() && $division !== 'Division 1'
        ? $this->early_bird_packet_price
        : (($division !== 'Division 1' || empty($this->d1_packet_price))
            ? $this->packet_price
            : $this->d1_packet_price);
}

Model methods


2. Routes & Controllers

Routes

// Public RSVP form
Route::get('/college-rsvp', [CollegeController::class, 'showRSVP'])
     ->name('colleges.showRSVP');

// Submit RSVP (handled by Livewire)
Route::post('/college-rsvp', [CollegeController::class, 'postRSVP'])
     ->name('colleges.postRSVP');

// Thank You page
Route::get('/college-rsvp/{colleges}', [CollegeController::class, 'rsvpThankYou'])
     ->name('colleges.rsvpThankYou');

Route definitions

CollegeController

  • showRSVP(Request $request)

Returns the public RSVP Blade view.

  • rsvpThankYou(string $colleges)

Displays a summary page after RSVPs are confirmed.

  • generateGraphic(College $college)

Dispatches a job to generate attendance graphics.

public function showRSVP(Request $request): View {
    return view('public.colleges.rsvp', compact('request'));
}

public function rsvpThankYou(string $colleges): View {
    $colleges = College::find(json_decode($colleges));
    $website  = $colleges->first()->event->website;
    return view('public.colleges.rsvp-thank-you', compact('colleges','website'));
}

Controller excerpt


3. Livewire Component: App\Http\Livewire\Public\Rsvp

A Flux-powered Livewire component orchestrates the RSVP flow:

  • State Properties: $selectedEvents, $coaches, $school, $rsvp_type, filters
  • mount(): Initializes state from session and ensures one coach row
  • events(): Retrieves upcoming, live events with allow_rsvp flag; supports name/zip filtering & distance sorting via GoogleMapsApi
  • cart(), subtotal(), fees(), total(): Calculates RSVP totals
  • submit():
  • Creates or updates College records with coach data
  • For Register, initiates Stripe checkout
  • For Interested, clears session and redirects to Thank You page
class Rsvp extends Component {
    public $website, $selectedEvents = [], $coaches = [], $rsvp_type, $filter_name, $filter_zip, $max_travel_distance;

    public function mount() {
        $this->session('get');
        if (empty($this->coaches)) $this->addCoach();
    }

    public function events() { /* ... */ }

    public function submit() {
        // Create/merge College entries...
        if ($this->rsvp_type === 'Register') {
            $this->checkout();
        } else {
            $this->session('forget');
            return redirect()
                ->route('colleges.rsvpThankYou', ['colleges'=>json_encode($colleges)]);
        }
    }
}

Livewire class

Public Blade Embed

@extends('layouts.simple', ['livewire' => true])

@section('content')
<div class="block-content pt-0">
    <livewire:public.colleges.rsvp :website="$website" />
</div>
@endsection

RSVP form view


4. Blade Partials

The form assembles several reusable partials:

Partial Purpose Snippet Citation
coach-details.blade.php Collect coach names, emails, phones (omitted for brevity)
attendance-type.blade.php Choose β€œRegister” or β€œInterested”
events.blade.php Filter & select one or more events
rsvp-type.blade.php Display RSVP Type cards
cart.blade.php Show cost breakdown before checkout (omitted)

5. Thank You Page

After an Interested RSVP, coaches see a confirmation listing their selected events:

@extends('layouts.simple', ['livewire' => true])

@section('content')
<h2 class="text-center font-bold">
  Thank you for confirming your interest in…
</h2>
@foreach ($colleges as $college)
  <div class="border rounded p-4" style="border-color:{{ $website->color }}">
    <img src="{{ $college->event->logo }}" class="w-24 mx-auto" />
    <h3 style="color:{{ $website->color }}">{{ $college->event->title }}</h3>
    <p>{{ $college->event->duration }} – {{ $college->event->address_city }}, {{ $college->event->address_state }}</p>
  </div>
@endforeach
@endsection

Thank You view


6. Relationships & Exports

  • College model links to an Event (event_id) and stores:
  • name, state, division, token
  • coaches JSON array
  • attendance_type & registered flags
  • Export: CollegeExport formats coach data into Excel, filtering out β€œStaff” entries.
public function collection(): Collection {
    return College::where('event_id', $this->event->id)
        ->get()
        ->filter(fn($c)=> $c->name !== $this->event->website->name.' Staff')
        ->flatMap(fn($c)=> json_decode($c->coaches))
        ->map(fn($coach)=> [/* … */]);
}

Excel export


7. Key Design Decisions

  • Livewire + Flux streamlines dynamic form state and instant feedback.
  • Session Storage retains partial form data across page reloads.
  • Pricing Logic lives in the Event model for consistent calculations.
  • Partial Views ensure consistent styling and reusability.
  • Queueable Graphic Generation decouples PDF creation from HTTP requests.

This comprehensive section empowers both administrators and college coaches with a robust, interactive RSVP experience, seamlessly integrated into the broader Prep Network events platform.