<?php
    // HEADERS
    header('Access-Control-Allow-Origin: *');
    header('Content-Type: application/json');
    header('Access-Control-Allow-Headers: Access-Control-Allow-Headers,Content-Type,Access-Control-Allow-Methods, Authorization, X-Requested-With');
if ($_SERVER['REQUEST_METHOD'] == 'GET') {

    include_once '../../config/Database.php';
    include_once '../../models/Fabricante.php';

    // INSTANTIATE DB AND CONNECT
    $database = new Database();
    $db = $database->connect();

    // INSTANTIATE POST OBJECT
    $fabricante = new Fabricante($db);

    // GET ID
    $fabricante->id = isset($_GET['id']) ? $_GET['id'] : die();

    // GET POST
    $fabricante->read_single();

    // CREATE ARRAY
    $fabricante_arr = array(
        'id' => $fabricante->id,
        'produtoFabricante' => $fabricante->produtoFabricante
    );

    // MAKE JSON
    print_r(json_encode($fabricante_arr));
}