diff --git a/src/Commands/PrefillFactory.php b/src/Commands/PrefillFactory.php index c59bd14..fb05bde 100644 --- a/src/Commands/PrefillFactory.php +++ b/src/Commands/PrefillFactory.php @@ -93,8 +93,9 @@ public function handle() ->values() ->all(); - $this->writeFactoryFile($factoryPath, $columnData, $modelClass); - $this->info('Factory blueprint created!'); + if ($this->writeFactoryFile($factoryPath, $columnData, $modelClass)) { + $this->info('Factory blueprint created!'); + } } /** @@ -385,11 +386,15 @@ protected function qualifyClass($name) * * @param string $path * @param array $data + * + * @return bool */ protected function writeFactoryFile($path, $data, $modelClass) { if (0 === count($data)) { - return $this->error('We could not find any data for your factory. Did you `php artisan migrate` already?'); + $this->error('We could not find any data for your factory. Did you `php artisan migrate` already?'); + + return false; } $content = $this->laravel->view->make('prefill-factory-helper::factory', [ @@ -398,5 +403,7 @@ protected function writeFactoryFile($path, $data, $modelClass) ])->render(); File::put($path, "