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.

Every live event in Boletilandia starts and ends in the admin panel. The EventoController (App\Http\Controllers\Admin\EventoController) handles all four operations — create, read, update, and delete — and every route it exposes is protected by the admin middleware, so only authenticated admin users can reach them.

Creating an Event

The Add Event form lives on the admin home page (admin.index) and submits to POST /admin-eventos, which is handled by EventoController::store().

Form Fields

NombreEvento
string
required
The display name of the event. Must be a non-empty string of at most 255 characters.
FechaEvento
date
required
The date of the event. Must be a valid date value (e.g. 2025-08-15).
DireccionEvento
string
required
The street address of the venue. Must be a non-empty string of at most 255 characters. Rendered as a <textarea> in the form.
LugarEvento
string
required
The name of the venue or location. Must be a non-empty string of at most 255 characters.
imagen_path
file
An optional banner image for the event. Must be a valid image file with a maximum size of 2048 KB (2 MB). Stored under the imagen_path/ directory on the public disk.
Only .jpg, .jpeg, and .png files are accepted by the upload input (accept=".jpg, .jpeg, .png"). Files exceeding 2 MB will fail Laravel’s max:2048 validation rule and return a validation error.

store() Method

// app/Http/Controllers/Admin/EventoController.php
public function store(Request $request)
{
    $validatedData = $request->validate([
        'NombreEvento'   => 'required|string|max:255',
        'FechaEvento'    => 'required|date',
        'DireccionEvento'=> 'required|string|max:255',
        'LugarEvento'    => 'required|string|max:255',
        'imagen_path'    => 'nullable|image|max:2048', // Manejo de imágenes
    ]);

    // Guardar la imagen, si es proporcionada
    if ($request->hasFile('imagen_path')) {
        $imagePath = $request->file('imagen_path')->store('imagen_path', 'public');
        $validatedData['imagen_path'] = $imagePath;
    }

    // Crear el evento en la base de datos
    Evento::create($validatedData);

    return redirect()->back()->with('Alerta_Exito', 'Evento agregado exitosamente');
}
On success, the controller redirects back to the Add Event page and flashes an Alerta_Exito session key that triggers a SweetAlert success dialog.

Viewing Events

GET /admin-ver_eventos queries all events whose FechaEvento is on or after the current server date (Carbon::now()->format('Y-m-d')), ordered by FechaEvento ascending, and passes the collection to admin.ver_eventos as $events. Each event card in that view displays:
  • Event name (NombreEvento)
  • Date (FechaEvento)
  • Address (DireccionEvento)
  • Venue (LugarEvento)
  • Banner image (rendered from storage/ if imagen_path is set)
  • Edit and Delete action buttons
If no upcoming events exist, the view renders the message “No hay eventos disponibles.”

Editing an Event

1

Open the edit form

Click Editar on any event card in the View Events list. The browser navigates to GET /admin-editar_eventos/{evento}, which calls EventoController::mostrarPantallaEdicion() and renders admin.editar_eventos with the existing event data pre-filled into each input.
2

Update the fields

Modify any combination of the five fields (same fields as the create form). The image field is optional on edit — leaving it blank keeps the existing image.
3

Submit the update

The form submits via PUT /admin-editar_eventos/{evento}, handled by EventoController::actualizarInfoEvento(). All text fields are passed through strip_tags() before the model is updated.

actualizarInfoEvento() Method

// app/Http/Controllers/Admin/EventoController.php
public function actualizarInfoEvento(Evento $evento, Request $request)
{
    $validatedData = $request->validate([
        'NombreEvento'   => 'required|string|max:255',
        'FechaEvento'    => 'required|date',
        'DireccionEvento'=> 'required|string|max:255',
        'LugarEvento'    => 'required|string|max:255',
        'imagen_path'    => 'nullable|image|max:2048',
    ]);

    // Guardar la imagen, si es proporcionada
    if ($request->hasFile('imagen_path')) {
        $imagePath = $request->file('imagen_path')->store('imagen_path', 'public');
        $validatedData['imagen_path'] = $imagePath;
    }

    $validatedData['NombreEvento']    = strip_tags($validatedData['NombreEvento']);
    $validatedData['FechaEvento']     = strip_tags($validatedData['FechaEvento']);
    $validatedData['DireccionEvento'] = strip_tags($validatedData['DireccionEvento']);
    $validatedData['LugarEvento']     = strip_tags($validatedData['LugarEvento']);

    $evento->update($validatedData);

    return redirect('admin-ver_eventos')->with('Alerta_Exito', 'Se editó correctamente');
}
After a successful update, the user is redirected to /admin-ver_eventos and a SweetAlert success dialog confirms the edit.

Deleting an Event

Clicking Eliminar on an event card does not immediately submit the form. Instead, it calls the JavaScript function confirmDelete(eventId), which triggers a SweetAlert confirmation dialog:
Swal.fire({
    title: "Are you sure?",
    text: "You won't be able to revert this!",
    icon: "warning",
    showCancelButton: true,
    confirmButtonColor: "#3085d6",
    cancelButtonColor: "#d33",
    confirmButtonText: "Yes, delete it!"
}).then((result) => {
    if (result.isConfirmed) {
        document.getElementById("deleteForm").action =
            "/admin-eliminar_eventos/" + eventId;
        document.getElementById("deleteForm").submit();
    }
});
Only if the admin confirms does the form submit as DELETE /admin-eliminar_eventos/{evento}, calling EventoController::eliminarEvento():
public function eliminarEvento(Evento $evento)
{
    $evento->delete();

    return redirect('admin-ver_eventos');
}
Deleting an event triggers the boot() method on the Evento model, which iterates over every related Seccion and calls $seccion->delete() on each one. Each Seccion deletion in turn cascades to remove all Asiento records belonging to that section — including any seats that have already been purchased. This operation is irreversible.
The cascade logic lives entirely in the Eloquent model boot hook:
// app/Models/Evento.php
protected static function boot()
{
    parent::boot();

    static::deleting(function ($evento) {
        $evento->secciones()->each(function ($seccion) {
            $seccion->delete(); // Elimina cada sección, activando la eliminación en cascada de los asientos
        });
    });
}

Build docs developers (and LLMs) love