@@ -25,7 +25,8 @@ class PruneCommand extends Command
25
25
{--model=* : Class names of the models to be pruned}
26
26
{--except=* : Class names of the models to be excluded from pruning}
27
27
{--chunk=1000 : The number of models to retrieve per chunk of models to be deleted}
28
- {--pretend : Display the number of prunable records found instead of deleting them} ' ;
28
+ {--pretend : Display the number of prunable records found instead of deleting them}
29
+ {--path=* : Absolute path(s) to directories where models are located} ' ;
29
30
30
31
/**
31
32
* The console command description.
@@ -125,7 +126,7 @@ protected function models()
125
126
throw new InvalidArgumentException ('The --models and --except options cannot be combined. ' );
126
127
}
127
128
128
- return collect ((new Finder )->in ($ this ->getDefaultPath ())->files ()->name ('*.php ' ))
129
+ return collect ((new Finder )->in ($ this ->getPath ())->files ()->name ('*.php ' ))
129
130
->map (function ($ model ) {
130
131
$ namespace = $ this ->laravel ->getNamespace ();
131
132
@@ -146,12 +147,16 @@ protected function models()
146
147
}
147
148
148
149
/**
149
- * Get the default path where models are located.
150
+ * Get the path where models are located.
150
151
*
151
152
* @return string|string[]
152
153
*/
153
- protected function getDefaultPath ()
154
+ protected function getPath ()
154
155
{
156
+ if (! empty ($ path = $ this ->option ('path ' ))) {
157
+ return $ path ;
158
+ }
159
+
155
160
return app_path ('Models ' );
156
161
}
157
162
0 commit comments