以前在創建數據庫表Migration,Model和Controller 分三步執行,現發現一條命令就可以搞定,超級贊,不過注意生成的文件都是到默認的目錄下,如果需要到指定位置,還得分開寫(Hppt/Models/Page)
php artisan make:model Page -crm
神奇的事情發生啦!

你想要的Model,Migration,Controller都有啦!!!
它們的路徑如下
model: app/Page.php
Controller: app/Http/Controller/PageController.php
MIgration: database/migrations/2018_11_30_073634_create_pages_table.php
通過查看Illuminate\Foundation\Console\ModelMakeCommand.php文件,我們可以看到-crm分別對應的意思
protected function getOptions()
{
return [
['all', 'a', InputOption::VALUE_NONE, 'Generate a migration, factory, and resource controller for the model'],
//c 創建一個controller
['controller', 'c', InputOption::VALUE_NONE, 'Create a new controller for the model'],
['factory', 'f', InputOption::VALUE_NONE, 'Create a new factory for the model'],
['force', null, InputOption::VALUE_NONE, 'Create the class even if the model already exists'],
// m 創建一個migration文件
['migration', 'm', InputOption::VALUE_NONE, 'Create a new migration file for the model'],
['pivot', 'p', InputOption::VALUE_NONE, 'Indicates if the generated model should be a custom intermediate table model'],
// r 設置controller文件的權限
['resource', 'r', InputOption::VALUE_NONE, 'Indicates if the generated controller should be a resource controller'],
];
}
