<?php

namespace App\Model;

use Shalex\Engine\DataBase;

class MusicModel
{
    static function getData()
    {
        $db = new DataBase();
        $result = $db->getDataBase('SELECT * FROM top_chart');
        var_dump($result);
        $box = [];
        if ($handle = opendir('./uploads')) {
            while (false !== ($entry = readdir($handle))) {
                $ext = pathinfo($entry, PATHINFO_EXTENSION);

                if ($ext == 'mp3') {
                    array_push($box, "./uploads/$entry");
                }
            }
            closedir($handle);
        }
        return $box;
    }
}
