<?php

class repository {

    public function repositoryActivo($inventory){

        if(!empty($inventory)){
            $result = self::searchRecord($inventory); 
        }else{

            $result = "La variable viene vacia";

        }

        return $result;
    }

    public function searchRecord($inventory):String {

        include 'conexion.php';

        $query = "SELECT id_activo from activos where id_activo = '$inventory'";
        $result = $conexion->query($query);

           while($row = $result -> fetch_array()){
               $data[] = array_map('utf8_encode', $row);
           }
 
           $resultado = json_encode($data, JSON_UNESCAPED_UNICODE);
           $result -> close();

        return $resultado;
    }
    
}

?>