From 62133950ecc88520e6aca3e5edcf8c9c4b6de8a6 Mon Sep 17 00:00:00 2001 From: Duilio Palacios Date: Thu, 26 Jan 2017 21:38:50 +0000 Subject: [PATCH] Generate model with make:controller --- src/Illuminate/Routing/Console/ControllerMakeCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) 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),