Skip to content

Commit

Permalink
app:name file existence check
Browse files Browse the repository at this point in the history
- moved file existence check into the replaceIn() functionality of the command
  • Loading branch information
ralphschindler committed Dec 1, 2016
1 parent 9b5cd61 commit 4914754
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Illuminate/Foundation/Console/AppNameCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,9 @@ protected function setServicesConfigNamespace()
*/
protected function setDatabaseFactoryNamespaces()
{
$modelFactoryFile = $this->laravel->databasePath().'/factories/ModelFactory.php';

if ($this->files->exists($modelFactoryFile)) {
$this->replaceIn($modelFactoryFile, $this->currentRoot, $this->argument('name'));
}
$this->replaceIn(
$this->laravel->databasePath().'/factories/ModelFactory.php', $this->currentRoot, $this->argument('name')
);
}

/**
Expand All @@ -240,7 +238,9 @@ protected function setDatabaseFactoryNamespaces()
*/
protected function replaceIn($path, $search, $replace)
{
$this->files->put($path, str_replace($search, $replace, $this->files->get($path)));
if ($this->files->exists($path)) {
$this->files->put($path, str_replace($search, $replace, $this->files->get($path)));
}
}

/**
Expand Down

0 comments on commit 4914754

Please sign in to comment.