<?php
// app/Http/Controllers/EventsController.php
namespace App\Http\Controllers;

use App\Models\Event;

class EventsController extends Controller
{
    // GET /events (latest only, like Express)
    public function index()
    {
        $event = Event::orderByDesc('year')->first();
        if (!$event) {
            return response()->json(['error' => 'No event found'], 404);
        }
        return $event; // Express returned the row (incl. year)
    }
}




