From 3562235233d159e8adbc6c22507339dc1dc2af51 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 6 Oct 2016 20:59:03 -0500 Subject: [PATCH] create a resource controller along with the model it's incredibly common for me to make a resource controller for most of my models, so it'd be nice do it in one line. while this would be a nicety, I can also see someone arguing that this adds unnecessary complexity, when it's already easy enough to just run the commands one after the other. curious where you stand on this, because we could just as easily add an option to create a seeder at the same time. --- src/Illuminate/Foundation/Console/ModelMakeCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Illuminate/Foundation/Console/ModelMakeCommand.php b/src/Illuminate/Foundation/Console/ModelMakeCommand.php index ea95a5135653..177666333225 100644 --- a/src/Illuminate/Foundation/Console/ModelMakeCommand.php +++ b/src/Illuminate/Foundation/Console/ModelMakeCommand.php @@ -42,6 +42,11 @@ public function fire() $this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]); } + if ($this->option('controller')) { + $controller = Str::camel(class_basename($this->argument('name'))); + + $this->call('make:controller', ['name' => "{$controller}Controller", '--resource' => true]); + } } } @@ -75,6 +80,7 @@ protected function getOptions() { return [ ['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model.'], + ['controller', 'c', InputOption::VALUE_NONE, 'Create a new resource controller for the model.'], ]; } }