77use Illuminate \Support \Collection ;
88use Illuminate \Support \Facades \Event ;
99use Illuminate \Support \Str ;
10- use InvalidArgumentException ;
1110use Maize \PrunableFields \Events \ModelsFieldsPruned ;
1211use Maize \PrunableFields \MassPrunableFields ;
1312use Maize \PrunableFields \PrunableFields ;
@@ -17,6 +16,7 @@ class PruneFieldsCommand extends Command
1716{
1817 protected $ signature = 'model:prune-fields
1918 {--model=* : Class names of the models to be pruned}
19+ {--except=* : Class names of the models to be excluded from pruning}
2020 {--chunk=1000 : The number of models to retrieve per chunk of models to be pruned}
2121 {--pretend : Display the number of prunable records found instead of pruning them} ' ;
2222
@@ -71,10 +71,6 @@ protected function models(): Collection
7171
7272 $ except = $ this ->option ('except ' );
7373
74- if (! empty ($ models ) && ! empty ($ except )) {
75- throw new InvalidArgumentException ('The --models and --except options cannot be combined. ' );
76- }
77-
7874 return collect ((new Finder ())->in ($ this ->getDefaultPath ())->files ()->name ('*.php ' ))
7975 ->map (function ($ model ) {
8076 $ namespace = $ this ->laravel ->getNamespace ();
@@ -93,6 +89,11 @@ protected function models(): Collection
9389 ->values ();
9490 }
9591
92+ protected function getDefaultPath (): string
93+ {
94+ return app_path ('Models ' );
95+ }
96+
9697 protected function isPrunable (string $ model ): bool
9798 {
9899 $ uses = class_uses_recursive ($ model );
0 commit comments