5.Laravel常用命令一览表

1.laravel

简述命令
查看laravel list命令帮助laravel --help | -h
laravel list --help | -h
查看laravel指定命令帮助laravel help <command>
laravel <command> --help | -h
查看Laravel Installer版本laravel --version | -V

2.laravel list

简述命令
查看laravel所有可用的命令laravel list

3.laravel new

简述命令
创建一个应用(根据提示操作)laravel new <app>

4.php artisan

简述命令
查看php artisan list命令帮助php artisan --help | -h
php artisan list --help | -h
查看php artisan指定命令帮助php artisan help <command>
php artisan <command> --help | -h
查看Laravel Framework版本php artisan --verison | -V

5.php artisan list

简述命令
查看php artisan所有可用的命令php artisan list

6.php artisan about/env

简述命令
查看应用基本信息php artisan about
查看应用环境php artisan env

7.php artisan make

控制器类的类体为空,资源控制器类的类体包含 index()show()create()store()edit()update()destroy() 方法,但方法体都为空。

简述命令
创建迁移文件php artisan make:migration create_articles_table
创建模型类php artisan make:model Article
创建模型类、迁移文件php artisan make:model Article --migration | -m
创建模型类、控制器类php artisan make:model Article --controller | -c
创建模型类、资源控制器类(id自动解析)php artisan make:model Article --controller --resource | -cr
创建控制器类php artisan make:controller ArticlesController
创建资源控制器类(id不自动解析)php artisan make:controller ArticlesController --resource
创建资源控制器类(id自动解析)、模型类php artisan make:controller ArticlesController --model=Article [--resource]
创建测试类php artisan make:test ArticleTest

8.php artisan migrate

简述命令
查看迁移文件状态php artisan migrate:status
执行所有未运行的迁移文件php artisan migrate
撤销最近一次migratephp artisan migrate:rollback
撤销最近几次migratephp artisan migrate:rollback --step=5
撤销所有migratephp artisan migrate:reset
撤销所有migrate并重新执行migrate,等同于reset + migrate。php artisan migrate:refresh
撤销最近几次migrate并重新执行migrate,等同于reset + migrate。php artisan migrate:refresh --step=5
删除数据库中的所有表并重新执行migrate。php artisan migrate:fresh

9.php artisan schema

简述命令
database/migrations 目录下的所有迁移文件“压缩”到 database/schema 目录下的名称为 <DB_CONNECTION>-schema 的 SQL 文件中,不删除 database/migrations 目录下的所有迁移文件。php artisan schema:dump
database/migrations 目录下的所有迁移文件“压缩”到 database/schema 目录下的名称为 <DB_CONNECTION>-schema 的 SQL 文件中,删除 database/migrations 目录下的所有迁移文件。php artisan schema:dump --prune

10.php artisan tinker

简述命令
运行tinkerphp artisan tinker

11.php artisan test

简述命令
运行测试php artisan test

12.php artisan serve/up/down

简述命令
启动应用php artisan serve
使应用退出维护模式php artisan up
将应用置于维护模式php artisan down

13.php artisan db

简述命令
连接到默认数据库连接的数据库CLIphp artisan db
连接到指定数据库连接的数据库CLIphp artisan db <DB_CONNECTION>
查看默认数据库连接的数据库信息php artisan db:show
查看指定数据库连接的数据库信息php artisan db:show --database=<DB_CONNECTION>
查看默认数据库连接的指定表的信息php artisan db:table <table>
查看指定数据库连接的指定表的信息php artisan db:table <table> --database=<DB_CONNECTION>

14.php artisan model

简述命令
查看指定模型类的信息php artisan model:show Flight

15.php artisan config

简述命令
查看所有配置php artisan config:show
创建配置缓存文件php artisan config:cache
删除配置缓存文件php artisan config:clear

16.php artisan route

简述命令
查看所有路由php artisan route:list
创建路由缓存文件php artisan route:cache
删除路由缓存文件php artisan route:clear

原创文章,作者:huoxiaoqiang,如若转载,请注明出处:https://www.huoxiaoqiang.com/php/phpenv/28562.html

(0)
上一篇 2023年6月4日
下一篇 2023年6月5日

相关推荐

  • 1.1PHP语言的标记(Tag)

    当解析一个文件时,PHP 会寻找起始和结束标记,也就是 <?php 和 ?>,而任何起始和结束标记之外的部分不会被 PHP 解析器处理,而是会被简单地原样输出。 例外地是当这部分处于条件语句中间时,此时 PHP 解释器会根据条件判断来决定哪些输出,哪些跳过。 以下示例中 PHP 将跳过条件语句未达成的段落,即使该…

    PHP语言教程 2023年6月1日
    0140
  • 2.9PHP语言的生成器(Generator)类

    1.生成器函数声明 生成器函数声明就跟普通函数声明一样,区别在于:生成器函数体必须至少包含一个 yield,可包含也可不包含 return。 yield 与 return 的区别在于:return 会立即终止函数的执行并返回值,而 yield 会向在生成器(Generator)类的对象上迭代的代码提供一个值,并暂停生成…

    PHP语言教程 2023年7月9日
    0190
  • 2.4PHP类型之类(Class)

    1.类声明 2.可变(Variable)类名 类的名称可以通过返回值为字符串类型的表达式动态指定。 3.继承 一个子类可以继承一个父类的 静态属性、实例属性、常量、静态方法、实例方法、构造函数、析构函数。 一个子类不可以继承自多个父类,一个子类只可以继承自一个父类,但可以多个子类继承自同一个父类。 4.覆盖(Overr…

    PHP语言教程 2023年7月4日
    0460

发表回复

登录后才能评论