<?php
declare(strict_types=1);

// Rest of your code...
namespace Controllers;

use Helpers\Request;
use Helpers\Response;
use Services\BlogService;

final class BlogController
{
    private BlogService $service;
    public function __construct() { $this->service = new BlogService(); }
    public function index(): never { Response::success($this->service->list(Request::query())); }
    public function show(string $slug): never
    {
        $blog = $this->service->detail($slug);
        if (!$blog) Response::error('Blog not found', 404);
        Response::success($blog);
    }
}
