diff --git a/src/Illuminate/Database/Console/Migrations/BaseCommand.php b/src/Illuminate/Database/Console/Migrations/BaseCommand.php index ba48921eb41e..8e81d2f66a58 100755 --- a/src/Illuminate/Database/Console/Migrations/BaseCommand.php +++ b/src/Illuminate/Database/Console/Migrations/BaseCommand.php @@ -13,14 +13,14 @@ class BaseCommand extends Command */ protected function getMigrationPaths() { - $realpath = $this->input->hasOption('realpath') && $this->option('realpath'); - // Here, we will check to see if a path option has been defined. If it has we will // use the path relative to the root of the installation folder so our database // migrations may be run for any customized path from within the application. if ($this->input->hasOption('path') && $this->option('path')) { - return collect($this->option('path'))->map(function ($path) use ($realpath) { - return $realpath ? $path : $this->laravel->basePath().'/'.$path; + return collect($this->option('path'))->map(function ($path) { + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$path + : $path; })->all(); } @@ -29,6 +29,16 @@ protected function getMigrationPaths() ); } + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } + /** * Get the path to the migration directory. * diff --git a/src/Illuminate/Database/Console/Migrations/FreshCommand.php b/src/Illuminate/Database/Console/Migrations/FreshCommand.php index 2def1c0d6311..39dec79128bf 100644 --- a/src/Illuminate/Database/Console/Migrations/FreshCommand.php +++ b/src/Illuminate/Database/Console/Migrations/FreshCommand.php @@ -102,9 +102,9 @@ protected function getOptions() ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], - ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed.'], - ['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'], ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'], diff --git a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php index ebf16855a3eb..dbeaed418b12 100755 --- a/src/Illuminate/Database/Console/Migrations/MigrateCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateCommand.php @@ -16,8 +16,8 @@ class MigrateCommand extends BaseCommand */ protected $signature = 'migrate {--database= : The database connection to use.} {--force : Force the operation to run when in production.} - {--path= : The path of migrations files to be executed.} - {--realpath : Mark the given migration path(s) as realpath.} + {--path= : The path to the migrations files to be executed.} + {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths.} {--pretend : Dump the SQL queries that would be run.} {--seed : Indicates if the seed task should be re-run.} {--step : Force the migrations to be run so they can be rolled back individually.}'; diff --git a/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php b/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php index 23b0651dbf6f..aafd973f17f1 100644 --- a/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php +++ b/src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php @@ -17,7 +17,7 @@ class MigrateMakeCommand extends BaseCommand {--create= : The table to be created.} {--table= : The table to migrate.} {--path= : The location where the migration file should be created.} - {--realpath : Mark the given migration path as realpath.}'; + {--realpath : Indicate any provided migration file paths are pre-resolved absolute paths.}'; /** * The console command description. @@ -124,11 +124,21 @@ protected function writeMigration($name, $table, $create) protected function getMigrationPath() { if (! is_null($targetPath = $this->input->getOption('path'))) { - $realpath = $this->input->hasOption('realpath') && $this->option('realpath'); - - return $realpath ? $targetPath : $this->laravel->basePath().'/'.$targetPath; + return ! $this->usingRealPath() + ? $this->laravel->basePath().'/'.$targetPath + : $targetPath; } return parent::getMigrationPath(); } + + /** + * Determine if the given path(s) are pre-resolved "real" paths. + * + * @return bool + */ + protected function usingRealPath() + { + return $this->input->hasOption('realpath') && $this->option('realpath'); + } } diff --git a/src/Illuminate/Database/Console/Migrations/RefreshCommand.php b/src/Illuminate/Database/Console/Migrations/RefreshCommand.php index c8ae9b341661..866b2133f092 100755 --- a/src/Illuminate/Database/Console/Migrations/RefreshCommand.php +++ b/src/Illuminate/Database/Console/Migrations/RefreshCommand.php @@ -142,9 +142,9 @@ protected function getOptions() ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], - ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed.'], - ['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'], ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'], diff --git a/src/Illuminate/Database/Console/Migrations/ResetCommand.php b/src/Illuminate/Database/Console/Migrations/ResetCommand.php index 82e79bffdeb1..c887ac494e7b 100755 --- a/src/Illuminate/Database/Console/Migrations/ResetCommand.php +++ b/src/Illuminate/Database/Console/Migrations/ResetCommand.php @@ -88,9 +88,9 @@ protected function getOptions() ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], - ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) of migrations files to be executed.'], + ['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed.'], - ['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'], ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], ]; diff --git a/src/Illuminate/Database/Console/Migrations/RollbackCommand.php b/src/Illuminate/Database/Console/Migrations/RollbackCommand.php index d86d5db711e2..eac23263ce9d 100755 --- a/src/Illuminate/Database/Console/Migrations/RollbackCommand.php +++ b/src/Illuminate/Database/Console/Migrations/RollbackCommand.php @@ -84,9 +84,9 @@ protected function getOptions() ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], - ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'], + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed.'], - ['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'], ['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'], diff --git a/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/src/Illuminate/Database/Console/Migrations/StatusCommand.php index e8612f1578e2..93ed51a7e019 100644 --- a/src/Illuminate/Database/Console/Migrations/StatusCommand.php +++ b/src/Illuminate/Database/Console/Migrations/StatusCommand.php @@ -105,9 +105,9 @@ protected function getOptions() return [ ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], - ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to use.'], + ['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to use.'], - ['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'], + ['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'], ]; } }