Skip to content

Commit

Permalink
Pruning Models: Get the default path for the models from a method ins…
Browse files Browse the repository at this point in the history
…tead (#40539)

* Get the default path for the models from a method instead

* Update PruneCommand.php

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
sander3 and taylorotwell authored Jan 21, 2022
1 parent a150549 commit e429bf5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Illuminate/Database/Console/PruneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected function models()
throw new InvalidArgumentException('The --models and --except options cannot be combined.');
}

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

Expand All @@ -114,6 +114,16 @@ protected function models()
})->values();
}

/**
* Get the default path where models are located.
*
* @return string
*/
protected function getDefaultPath()
{
return app_path('Models');
}

/**
* Determine if the given model class is prunable.
*
Expand Down

0 comments on commit e429bf5

Please sign in to comment.