Esempio n. 1
0
 /**
  * Get all of the files at a given path.
  *
  * @param  string  $path
  * @return array
  */
 protected function getFiles($path)
 {
     if (isset($this->seeds)) {
         return $this->seeds;
     }
     // If the seeds haven't been read before, we will glob the directory and sort
     // them alphabetically just in case the developer is using numbers to make
     // the seed run in a certain order based on their database design needs.
     $files = $this->files->glob($path . '/*.php');
     sort($files);
     return $this->seeds = $files;
 }
Esempio n. 2
0
 /**
  * Get all of the migration files in a given path.
  *
  * @param  string  $path
  * @return array
  */
 public function getMigrationFiles($path)
 {
     $files = $this->files->glob($path . '/*_*.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);
     return $files;
 }