Tickets connect attendees to events. When a user purchases tickets for an event, Eventify creates a ticket record, deducts the requested quantity from the event’s remaining capacity, and increments the attendee count — all in a single atomic operation. If the purchase brings capacity to zero, the event is automatically marked as sold out.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/astrxnomo/eventify-app/llms.txt
Use this file to discover all available pages before exploring further.
Ticket Model Fields
Ticket records are stored in thetickets table, created by the following migration:
Auto-incrementing primary key.
Foreign key referencing the
users table. Identifies the purchaser.Foreign key referencing the
events table. Identifies the event the ticket is for.Number of individual tickets purchased in this transaction.
Populated by Laravel’s soft-delete mechanism when a ticket record is soft-deleted.
null for active tickets.Purchasing Tickets
Tickets are purchased by submitting a form on the event detail page to:auth middleware — users must be logged in to purchase tickets.
The purchase flow handled by TicketController::store() runs as follows:
Enforce capacity
Before creating any record, the controller validates that the requested quantity can be fulfilled:If the event has no remaining capacity, or the requested quantity exceeds what’s left, the request is rejected and the user is redirected back with an error message.
Create the ticket record
A new
Ticket is instantiated and saved with the quantity, event ID, and the authenticated user’s ID:Update event capacity and attendance
The event’s
capacity is decremented and attendees is incremented by the purchased quantity:Mark as sold out if needed
If the purchase brings
capacity exactly to zero, the event’s status is automatically changed to Agotado (status_id = 2):Capacity Enforcement
The capacity check is the central guard that prevents overselling. The condition covers two distinct failure scenarios:| Scenario | Condition triggered | Result |
|---|---|---|
| User requests more tickets than are left | $event->capacity < $request->quantity | Redirect with error |
| Event is already sold out | $event->capacity == 0 | Redirect with error |
| Sufficient tickets remain | Neither condition | Purchase proceeds |
My Tickets Dashboard
Authenticated users can view all their ticket purchases at:TicketController::showMyTickets() method returns tickets belonging to the currently authenticated user, ordered from most recent to oldest:
event relationship, giving the view access to the event name, dates, location, and price for display.
PDF Ticket Report
Each ticket purchase can be downloaded as a PDF. The report is generated on demand at:TicketController::generateTicket() method loads the full ticket with its associated event and user, parses the event dates using Carbon, calculates the total cost, and renders a Blade view as a downloadable PDF:
ticket.pdf) includes:
- Event name, start date, and end date (Carbon-formatted)
- Ticket quantity
- Per-ticket price and calculated total
- Purchasing user details
Ticket editing and deletion are not supported through the UI. The
edit, update, and destroy methods exist as stubs in TicketController but contain no implementation. Only purchasing (via store) and PDF download (via generateTicket) are available to end users.Relationships
TheTicket model declares the following Eloquent relationships:
User
The authenticated user who purchased the ticket. Used on the dashboard to scope each user’s ticket list.
Event
The event the ticket is for. Eagerly loaded when generating the PDF report to provide name, dates, price, and location.