BaseCommand.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Illuminate\Database\Console\Migrations;
  3. use Illuminate\Console\Command;
  4. class BaseCommand extends Command
  5. {
  6. /**
  7. * Get all of the migration paths.
  8. *
  9. * @return array
  10. */
  11. protected function getMigrationPaths()
  12. {
  13. // Here, we will check to see if a path option has been defined. If it has we will
  14. // use the path relative to the root of the installation folder so our database
  15. // migrations may be run for any customized path from within the application.
  16. if ($this->input->hasOption('path') && $this->option('path')) {
  17. return collect($this->option('path'))->map(function ($path) {
  18. return $this->laravel->basePath().'/'.$path;
  19. })->all();
  20. }
  21. return array_merge(
  22. [$this->getMigrationPath()], $this->migrator->paths()
  23. );
  24. }
  25. /**
  26. * Get the path to the migration directory.
  27. *
  28. * @return string
  29. */
  30. protected function getMigrationPath()
  31. {
  32. return $this->laravel->databasePath().DIRECTORY_SEPARATOR.'migrations';
  33. }
  34. }