Skip to content

Commit 98842da

Browse files
committed
formatting
1 parent 0671f31 commit 98842da

File tree

8 files changed

+40
-20
lines changed

8 files changed

+40
-20
lines changed

src/Illuminate/Database/Console/Migrations/BaseCommand.php

+14-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ class BaseCommand extends Command
1313
*/
1414
protected function getMigrationPaths()
1515
{
16-
$realpath = $this->input->hasOption('realpath') && $this->option('realpath');
17-
1816
// Here, we will check to see if a path option has been defined. If it has we will
1917
// use the path relative to the root of the installation folder so our database
2018
// migrations may be run for any customized path from within the application.
2119
if ($this->input->hasOption('path') && $this->option('path')) {
22-
return collect($this->option('path'))->map(function ($path) use ($realpath) {
23-
return $realpath ? $path : $this->laravel->basePath().'/'.$path;
20+
return collect($this->option('path'))->map(function ($path) {
21+
return ! $this->usingRealPath()
22+
? $this->laravel->basePath().'/'.$path
23+
: $path;
2424
})->all();
2525
}
2626

@@ -29,6 +29,16 @@ protected function getMigrationPaths()
2929
);
3030
}
3131

32+
/**
33+
* Determine if the given path(s) are pre-resolved "real" paths.
34+
*
35+
* @return bool
36+
*/
37+
protected function usingRealPath()
38+
{
39+
return $this->input->hasOption('realpath') && $this->option('realpath');
40+
}
41+
3242
/**
3343
* Get the path to the migration directory.
3444
*

src/Illuminate/Database/Console/Migrations/FreshCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ protected function getOptions()
102102

103103
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
104104

105-
['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'],
105+
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed.'],
106106

107-
['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'],
107+
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'],
108108

109109
['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'],
110110

src/Illuminate/Database/Console/Migrations/MigrateCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class MigrateCommand extends BaseCommand
1616
*/
1717
protected $signature = 'migrate {--database= : The database connection to use.}
1818
{--force : Force the operation to run when in production.}
19-
{--path= : The path of migrations files to be executed.}
20-
{--realpath : Mark the given migration path(s) as realpath.}
19+
{--path= : The path to the migrations files to be executed.}
20+
{--realpath : Indicate any provided migration file paths are pre-resolved absolute paths.}
2121
{--pretend : Dump the SQL queries that would be run.}
2222
{--seed : Indicates if the seed task should be re-run.}
2323
{--step : Force the migrations to be run so they can be rolled back individually.}';

src/Illuminate/Database/Console/Migrations/MigrateMakeCommand.php

+14-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MigrateMakeCommand extends BaseCommand
1717
{--create= : The table to be created.}
1818
{--table= : The table to migrate.}
1919
{--path= : The location where the migration file should be created.}
20-
{--realpath : Mark the given migration path as realpath.}';
20+
{--realpath : Indicate any provided migration file paths are pre-resolved absolute paths.}';
2121

2222
/**
2323
* The console command description.
@@ -124,11 +124,21 @@ protected function writeMigration($name, $table, $create)
124124
protected function getMigrationPath()
125125
{
126126
if (! is_null($targetPath = $this->input->getOption('path'))) {
127-
$realpath = $this->input->hasOption('realpath') && $this->option('realpath');
128-
129-
return $realpath ? $targetPath : $this->laravel->basePath().'/'.$targetPath;
127+
return ! $this->usingRealPath()
128+
? $this->laravel->basePath().'/'.$targetPath
129+
: $targetPath;
130130
}
131131

132132
return parent::getMigrationPath();
133133
}
134+
135+
/**
136+
* Determine if the given path(s) are pre-resolved "real" paths.
137+
*
138+
* @return bool
139+
*/
140+
protected function usingRealPath()
141+
{
142+
return $this->input->hasOption('realpath') && $this->option('realpath');
143+
}
134144
}

src/Illuminate/Database/Console/Migrations/RefreshCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ protected function getOptions()
142142

143143
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
144144

145-
['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'],
145+
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed.'],
146146

147-
['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'],
147+
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'],
148148

149149
['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'],
150150

src/Illuminate/Database/Console/Migrations/ResetCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ protected function getOptions()
8888

8989
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
9090

91-
['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) of migrations files to be executed.'],
91+
['path', null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'The path(s) to the migrations files to be executed.'],
9292

93-
['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'],
93+
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'],
9494

9595
['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'],
9696
];

src/Illuminate/Database/Console/Migrations/RollbackCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ protected function getOptions()
8484

8585
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
8686

87-
['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to be executed.'],
87+
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to be executed.'],
8888

89-
['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'],
89+
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'],
9090

9191
['pretend', null, InputOption::VALUE_NONE, 'Dump the SQL queries that would be run.'],
9292

src/Illuminate/Database/Console/Migrations/StatusCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ protected function getOptions()
105105
return [
106106
['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'],
107107

108-
['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to use.'],
108+
['path', null, InputOption::VALUE_OPTIONAL, 'The path to the migrations files to use.'],
109109

110-
['realpath', null, InputOption::VALUE_NONE, 'Mark the given migration path(s) as realpath.'],
110+
['realpath', null, InputOption::VALUE_NONE, 'Indicate any provided migration file paths are pre-resolved absolute paths.'],
111111
];
112112
}
113113
}

0 commit comments

Comments
 (0)