🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 【Laravel】 常用的artisan命令 ## 全局相关 | 命令 | 说明 | | --- | --- | | php artisan | 查看artisan命令,同 php artisan list | | php artisan help make:model | 查看某个帮助命令 | | php artisan --version | 查看laravel版本 | | php artisan serve | 使用 PHP 内置的开发服务器启动应用 | | php artisan key:generate | 生成一个随机的 key,并自动更新到 app/config/app.php 的 key 键值对(刚安装好需要做这一步) | | php artisan down | 将站点设为维护状态(显示503) | | php artisan up | 将站点设回可访问状态 | | php artisan tinker | 进入tinker工具 | | php artisan route:list | 列出所有的路由 | | php artisan route:cache | 生成路由缓存文件 | | php artisan route:clear | 移除缓存路由文件文件 | ## 功能相关 | 命令 | 说明 | | --- | --- | | php artisan make:controller StudentController | 创建控制器 | | php artisan make:controller PhotoController --resource | 创建Rest风格资源控制器(带有index、create、store、edit、update、destroy、show方法) | | php artisan make:model Student | 创建模型 | | php artisan migrate:install | 初始化迁移数据表 | | php artisan make:migration create_users_table --create=students //创建students表 | 创建新建表的迁移 | | php artisan make:migration add_votes_to_users_table --table=students //给students表增加votes字段 | 创建修改表的迁移 | | php artisan migrate | 执行迁移 | | php artisan make:model Student -m | 创建模型的时候同时生成新建表的迁移 | | php artisan migrate:rollback | 回滚上一次的迁移 | | php artisan migrate:reset | 回滚所有迁移 | | php artisan make:seeder StudentTableSeeder | 创建填充 | | php artisan db:seed --class=StudentTableSeeder | 执行单个填充 | | php artisan db:seed | 执行所有填充 | | php artisan migrate:refresh --seed | 回滚所有迁移并填充数据 | | php artisan make:middleware Activity | 创建中间件(app/Http/Middleware 下) | | php artisan queue:table | 创建队列(数据库)的表迁移(需要执行迁移才生效) | | php artisan make:job SendEmail | 创建队列类(app/jobs下) | | php artisan make:request CreateArticleRequest | 创建请求类(app/Http/Requests下) | | php artisan cache:clear | 清除应用程序缓存 |