Skip to content

Commit

Permalink
create a resource controller along with the model
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
browner12 authored Oct 7, 2016
1 parent 1c78e00 commit 3562235
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Illuminate/Foundation/Console/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}
}

Expand Down Expand Up @@ -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.'],
];
}
}

0 comments on commit 3562235

Please sign in to comment.