Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AndresLopezCorrales/Boletilandia/llms.txt

Use this file to discover all available pages before exploring further.

After completing a seat purchase, Boletilandia automatically prompts you to download a personalized PDF ticket. The file is generated on the fly by DomPDF from a Blade template and streams directly to your browser as boleto.pdf — no external service or email required.
The PDF is rendered fresh on every request by DomPDF. Your Laravel session must still be active at the time you click OK in the confirmation dialog, because the ticket template reads letra_seccion and numero_asiento directly from the session. If the session has expired, those values will be missing from the downloaded file.

Triggering the Download

When a purchase succeeds, the server redirects to /home with a message = 'boleto comprado' flash value and stores three session keys (evento_id, letra_seccion, numero_asiento). The home Blade template detects both values and injects the following SweetAlert2 script:
@if (Session::has('message') && Session::has('evento_id'))
<script>
    var eventoId = {{ Session::get('evento_id') }};
    window.Swal.fire({
        title: "Comprado!",
        text: "Boleto Comprado. Descarga tu boleto dando 'OK'",
        icon: "success"
        }).then((result) =>{
            if(result.isConfirmed){
                var csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
                var formPdf = document.createElement('form');
                formPdf.style.display = 'none';
                formPdf.method = 'GET';
                formPdf.action = '/pdf-boleto/' + eventoId;

                var inputTokenPdf = document.createElement('input');
                inputTokenPdf.type = 'hidden';
                inputTokenPdf.name = '_token';
                inputTokenPdf.value = csrfToken;

                document.body.appendChild(formPdf);

                formPdf.submit();
            }
        });
</script>
@endif
Clicking OK submits the hidden GET form to /pdf-boleto/{evento_id}.

The PDF Generation Route

GET /pdf-boleto/{evento}
This route is protected by the user middleware and is handled by PdfController::generarPdf():
public function generarPdf(Evento $evento)
{
    $pdf = Pdf::loadView('home.pdf-boleto', compact('evento'));
    return $pdf->download('boleto.pdf');
}
Laravel’s route model binding resolves {evento} to the matching Evento record automatically. DomPDF loads the home.pdf-boleto Blade view, renders it to PDF, and streams the result as a file download named boleto.pdf.

Session Keys Used

Session keyContents
evento_idThe integer ID of the purchased event
letra_seccionThe section letter (e.g., A, B, H)
numero_asientoThe seat number within that section
These three keys are written by BoletoController::comprarAsiento() immediately after a successful seat save and are consumed by the PDF Blade template via Session::get().

What the PDF Contains

The rendered ticket includes the following information pulled from the Evento model and the active session:

NombreEvento

The event name, shown as a large <h1> heading at the top of the ticket.

Auth user name

A personalised welcome line: Bienvenido, , using Auth::user()->name.

LugarEvento

The venue name, listed under Lugar: in the event details section.

DireccionEvento

The venue street address, listed under Dirección:.

FechaEvento

The event date, listed under Fecha:.

Seat assignment

The section letter and seat number from the session, displayed as {letra_seccion} - {numero_asiento} in a centred <h2>.

The PDF Blade Template

The full source of resources/views/home/pdf-boleto.blade.php is reproduced below. DomPDF renders this HTML to produce the downloadable file:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=}, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>
        Boleto {{$evento->id}}.
        {{Session::get('letra_seccion')}} - {{Session::get('numero_asiento')}}
    </title>
    <style>
        #evento, #usuario, #asiento, #nota {
            text-align: center
        }
        #nota {
            color: red
        }
    </style>
</head>
<body>
    <h1 id="evento">{{$evento->NombreEvento}}</h1>
    <h2 id="usuario">Bienvenido, {{ Auth::user()->name}}</h2>

    <p>Ya estas listo para ir al concierto de
        <strong>{{$evento->NombreEvento}}!</strong>
    </p>
    <p>Se llevará a cabo en: </p><br>
    <ul>
        <li><p><strong>Lugar: </strong>{{$evento->LugarEvento}}</p></li>
        <li><p><strong>Dirección: </strong>{{$evento->DireccionEvento}}</p></li>
        <li><p><strong>Fecha: </strong>{{$evento->FechaEvento}}</p></li>
    </ul>
    <p>Tus asientos son:</p>
    <h2 id="asiento">
        {{Session::get('letra_seccion')}} - {{Session::get('numero_asiento')}}
    </h2><br>

    <p>Presenta esta hoja para atender al evento</p>
    <p id="nota">
        NOTA: SI NO SE PRESENTA CON ESTA HOJA, SE LE NEGARÁ LA ENTRADA
    </p>
</body>
</html>

The Admission Warning

The final line of the ticket, styled in red via #nota { color: red }, reads:
NOTA: SI NO SE PRESENTA CON ESTA HOJA, SE LE NEGARÁ LA ENTRADA
This note instructs attendees that they must present the printed or on-screen PDF to gain entry. There is no QR code or barcode validation in the current implementation — venue staff verify the ticket visually.
Save or print the PDF immediately after it downloads. Session data in Laravel has a configurable lifetime (default 120 minutes) and may expire if you wait too long before clicking OK in the confirmation dialog. Once the session keys letra_seccion and numero_asiento are gone, the ticket template will render without your seat assignment and you will need to contact the event organiser directly.

Build docs developers (and LLMs) love