<?php


namespace Heanup\App\Api\Controller;


use Heanup\App\Api\Config\Code;
use Heanup\App\Api\Controller;
use Heanup\App\Api\Package\Database\Num;

class Countries extends Controller
{
    protected function main()
    {
        $sql="SELECT DISTINCT country FROM `phone_num`";
        $db_country=Num::getConnection()->read($sql, []);
        $db_country=array_column($db_country, "country");
        $db_country=array_fill_keys($db_country, 1);
        $this->countries=Code::getData();
        $this->countries=array_intersect_key($this->countries, $db_country);
        $this->render();
    }
}