BaseCommand.php
2 years ago
FreshCommand.php
3 weeks ago
InstallCommand.php
3 weeks ago
MigrateCommand.php
3 weeks ago
MigrateMakeCommand.php
3 weeks ago
RefreshCommand.php
2 years ago
ResetCommand.php
3 weeks ago
RollbackCommand.php
2 years ago
StatusCommand.php
3 weeks ago
TableGuesser.php
2 years ago
BaseCommand.php
45 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Database\Console\Migrations; |
| 4 | |
| 5 | use IAWPSCOPED\Illuminate\Console\Command; |
| 6 | /** @internal */ |
| 7 | class BaseCommand extends Command |
| 8 | { |
| 9 | /** |
| 10 | * Get all of the migration paths. |
| 11 | * |
| 12 | * @return array |
| 13 | */ |
| 14 | protected function getMigrationPaths() |
| 15 | { |
| 16 | // Here, we will check to see if a path option has been defined. If it has we will |
| 17 | // use the path relative to the root of the installation folder so our database |
| 18 | // migrations may be run for any customized path from within the application. |
| 19 | if ($this->input->hasOption('path') && $this->option('path')) { |
| 20 | return \IAWPSCOPED\collect($this->option('path'))->map(function ($path) { |
| 21 | return !$this->usingRealPath() ? $this->laravel->basePath() . '/' . $path : $path; |
| 22 | })->all(); |
| 23 | } |
| 24 | return \array_merge($this->migrator->paths(), [$this->getMigrationPath()]); |
| 25 | } |
| 26 | /** |
| 27 | * Determine if the given path(s) are pre-resolved "real" paths. |
| 28 | * |
| 29 | * @return bool |
| 30 | */ |
| 31 | protected function usingRealPath() |
| 32 | { |
| 33 | return $this->input->hasOption('realpath') && $this->option('realpath'); |
| 34 | } |
| 35 | /** |
| 36 | * Get the path to the migration directory. |
| 37 | * |
| 38 | * @return string |
| 39 | */ |
| 40 | protected function getMigrationPath() |
| 41 | { |
| 42 | return $this->laravel->databasePath() . \DIRECTORY_SEPARATOR . 'migrations'; |
| 43 | } |
| 44 | } |
| 45 |