<?php

namespace App\Middlewares;

class WorkerMiddleware
{
    public function handle() {

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