<?php

namespace App\Middlewares;

class AdminMiddleware
{
    public function handle() {

        if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'ADMIN') {
            $_SESSION['message'] = "No tienes permisos para acceder a esta ruta.";
            $_SESSION['message_type'] = "danger";
            header("Location: " . BASE_HEADER . "dashboard");
            exit;
        }
    }
}