我可以使用以下命令创建一个模型和资源控制器(绑定到模型)

php artisan make:controller TodoController --resource --model=Todo

I want to also create a migration with the above command, is it possible?

推荐答案

如果你从模型开始就可以做到

php artisan make:model Todo -mcr

如果你运行php artisan make:model --help,你可以看到所有可用的选项

-m, --migration Create a new migration file for the model.
-c, --controller Create a new controller for the model.
-r, --resource Indicates if the generated controller should be a resource controller

Update

As mentioned in the comments by @arun in newer versions of laravel > 5.6 it is possible to run following command:

php artisan make:model Todo -a

-a, --all Generate a migration, factory, and resource controller for the model

Laravel相关问答推荐

Laravel 5.8 在从已清除的会话中单击注销后显示419 Page Expired

Laravel 中的 index()" 是什么意思?

Laravel 5 如何全局设置 Cache-Control HTTP 标头?

Laravel 4:验证前修剪输入的最佳实践

Laravel Electron邮件验证模板位置

Laravel 5 - 在控制器文件中为多个路由定义中间件

从 Laravel Cashier 获取下一个账单日期

错误:您的要求无法解析为一组可安装的软件包.

laravel Blade中多选选项中的旧值

Laravel:自定义或扩展通知 - 数据库模型

Laravel 全部返回 ID 变为 0

laravel 搜索多个以空格分隔的单词

如何在 php Laravel 中对关联数组进行排序

如何重定向到laravel上的公共文件夹

在 Laravel 中按用户名查找用户

assets资源不引用公用文件夹(Laravel)

Laravel 删除集合中的第一项

如果在 Laravel 5.1 中找不到路由,则显示 404 页面

Distinct values with pluck

错误:找不到模块 'webpack/lib/rules/DescriptionDataMatcherRulePlugin' 需要堆栈: