Nwidart\Modules\Migrations\Migrator::getMigrations PHP 메소드

getMigrations() 공개 메소드

Get migration files.
public getMigrations ( boolean $reverse = false ) : array
$reverse boolean
리턴 array
    public function getMigrations($reverse = false)
    {
        $files = $this->laravel['files']->glob($this->getPath() . '/*_*.php');
        // Once we have the array of files in the directory we will just remove the
        // extension and take the basename of the file which is all we need when
        // finding the migrations that haven't been run against the databases.
        if ($files === false) {
            return array();
        }
        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));
        }, $files);
        // Once we have all of the formatted file names we will sort them and since
        // they all start with a timestamp this should give us the migrations in
        // the order they were actually created by the application developers.
        sort($files);
        if ($reverse) {
            return array_reverse($files);
        }
        return $files;
    }