『laravel』中 php artisan make

1、 创建控制器–controller

php artisan make:controller 『controllername』

创建rest风格资源控制器(带有index,create、store、edit、update、destroy、show等)

php artisan make:controller 『controllername』 --resource

2、 创建模型–model

php artisan make:model 『modelname』

创建模型的时候同时生成新建表的迁移

php artisan make:model 『modelname』-m

3、 创建填充–seeder

php artisan make:seeder 『seedername』  

eg:php artisan make:seeder StudentTableSeeder 

执行单个填充

php artisan db:seed --class=『seedername』

eg:php artisan db:seed --class=StudentTableSeeder 

执行所有填充

php artisan db:seed

4、 创建中间件

php artisan make:middleware 『middlewarename』

eg:php artisan make:middleware Activity

5、 创建队列类

php artisan make:job 『jobname』

eg:php artisan make:job SendEmail

6、 创建请求类

php artisan make:request 『requestname』

eg:php artisan make:request 『CreateArticleRequest』

版权声明:本文为u010496966原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。