Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] app:name - add file exists check for ModelFactory.php during namespace replacement #16592

Merged
merged 3 commits into from
Dec 1, 2016
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Illuminate/Foundation/Console/AppNameCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ protected function setServicesConfigNamespace()
*/
protected function setDatabaseFactoryNamespaces()
{
$this->replaceIn(
$this->laravel->databasePath().'/factories/ModelFactory.php', $this->currentRoot, $this->argument('name')
);
$modelFactoryFile = $this->laravel->databasePath().'/factories/ModelFactory.php';

if ($this->files->exists($modelFactoryFile)) {
$this->replaceIn($modelFactoryFile, $this->currentRoot, $this->argument('name'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be simpler to do that check directly in replaceIn function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is a good idea, ... updating PR.

}
}

/**
Expand Down