Skip to content

Commit 9455090

Browse files
committed
Allow an array, but fall back to app/Models
1 parent e51f146 commit 9455090

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/Illuminate/Database/Console/PruneCommand.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PruneCommand extends Command
2424
{--except=* : Class names of the models to be excluded from pruning}
2525
{--chunk=1000 : The number of models to retrieve per chunk of models to be deleted}
2626
{--pretend : Display the number of prunable records found instead of deleting them}
27-
{--path=Models : The default path where models are located}';
27+
{--path=* : Absolute path(s) to directories where models are located}';
2828

2929
/**
3030
* The console command description.
@@ -97,7 +97,7 @@ protected function models()
9797
throw new InvalidArgumentException('The --models and --except options cannot be combined.');
9898
}
9999

100-
return collect((new Finder)->in($this->getDefaultPath())->files()->name('*.php'))
100+
return collect((new Finder)->in($this->getPath())->files()->name('*.php'))
101101
->map(function ($model) {
102102
$namespace = $this->laravel->getNamespace();
103103

@@ -120,9 +120,14 @@ protected function models()
120120
*
121121
* @return string
122122
*/
123-
protected function getDefaultPath()
123+
protected function getPath()
124124
{
125-
return app_path($this->option('path'));
125+
126+
if (! empty($path = $this->option('path'))) {
127+
return $path;
128+
}
129+
130+
return app_path('Models');
126131
}
127132

128133
/**

0 commit comments

Comments
 (0)