Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dbhynds/framework into db…
Browse files Browse the repository at this point in the history
…hynds-master
  • Loading branch information
taylorotwell committed Jan 9, 2024
2 parents 47c2c6f + 9d687c9 commit b94408d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Illuminate/Database/Console/PruneCommand.php
Expand Up @@ -25,7 +25,8 @@ class PruneCommand extends Command
{--model=* : Class names of the models to be pruned}
{--except=* : Class names of the models to be excluded from pruning}
{--chunk=1000 : The number of models to retrieve per chunk of models to be deleted}
{--pretend : Display the number of prunable records found instead of deleting them}';
{--pretend : Display the number of prunable records found instead of deleting them}
{--path=* : Absolute path(s) to directories where models are located}';

/**
* The console command description.
Expand Down Expand Up @@ -125,7 +126,7 @@ protected function models()
throw new InvalidArgumentException('The --models and --except options cannot be combined.');
}

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

Expand All @@ -146,12 +147,16 @@ protected function models()
}

/**
* Get the default path where models are located.
* Get the path where models are located.
*
* @return string|string[]
*/
protected function getDefaultPath()
protected function getPath()
{
if (! empty($path = $this->option('path'))) {
return $path;
}

return app_path('Models');
}

Expand Down

0 comments on commit b94408d

Please sign in to comment.