Bar*_*vdh 37
观看此视频:http://youtu.be/AjQ5e9TOZVk?t = 1m45s
您可以php artisan list查看所有命令,生成REST-ful控制器的命令是controller:make
您可以通过以下方式查看用法:php artisan help make:controller
Dut*_*IFF 35
Laravel 5
其他答案对Laravel 4来说很棒,但是Laravel 5就在这里!我们现在可以默认生成各种东西.运行php artisan help以查看所有工匠命令.以下是所有make命令:
make
make:command Create a new command class
make:console Create a new Artisan command
make:controller Create a new resource controller class
make:event Create a new event class
make:middleware Create a new middleware class
make:migration Create a new migration file
make:model Create a new Eloquent model class
make:provider Create a new service provider class
make:request Create a new form request class
Run Code Online (Sandbox Code Playgroud)
注意:我们不再使用item:make.相反,我们现在有:item.
运行php artisan help make:item以查看可以传递的内容.例如php artisan help make:migration,我们需要传递迁移名称,但我们也可以传递它--create=""或--table=""指定要分别创建或修改的表名.运行php artisan make:migration create_articles_table --create="articles"以生成文章表.此外,生成模型负责为该模型生成迁移.遵循命名约定,它将被复数用于迁移.
Sop*_*phy 24
谢谢@ user1909426,我可以通过php artisan list它找到解决方案,列出L4上使用的所有命令.它只能创建控制器而不是模型.我按照这个命令生成控制器.
php artisan controller:make [Name]Controller
Run Code Online (Sandbox Code Playgroud)
在Laravel 5上,命令已更改:
php artisan make:controller [Name]Controller
Run Code Online (Sandbox Code Playgroud)
注意: [名称]控制器名称
对于generate Model,具有资源和迁移的最佳控制器是:
php artisan make:model ModelName -m -cr
Run Code Online (Sandbox Code Playgroud)
小智 5
制作模型、控制器
php artisan make:model Customer -mc
Run Code Online (Sandbox Code Playgroud)
制作模型、控制器和资源
php artisan make:model Customer -mcr
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
122659 次 |
| 最近记录: |