diff --git a/src/Illuminate/Routing/Console/ControllerMakeCommand.php b/src/Illuminate/Routing/Console/ControllerMakeCommand.php index ac1d98de2b6f..d9d7f6ce2227 100755 --- a/src/Illuminate/Routing/Console/ControllerMakeCommand.php +++ b/src/Illuminate/Routing/Console/ControllerMakeCommand.php @@ -74,6 +74,12 @@ protected function buildClass($name) if ($this->option('model')) { $modelClass = $this->parseModel($this->option('model')); + if (! class_exists($modelClass)) { + if ($this->confirm("The model $modelClass does not exist. Do you want to generate it?")) { + $this->call('make:model', ['name' => $modelClass]); + } + } + $replace = [ 'DummyFullModelClass' => $modelClass, 'DummyModelClass' => class_basename($modelClass),