phuocqn2/fillable

Artisan 命令获取表字段

dev-master 2021-06-23 02:22 UTC

This package is auto-updated.

Last update: 2024-09-23 09:31:59 UTC


README

该包帮助DEV通过命令行查看数据库中的表及其字段的列表。

此外,您还可以使用这些字段来在模型中声明 fillable。

安装

运行命令

  • composer require phuocqn/fillable:dev-master

或者如果您只想在开发环境中安装,运行以下命令:

  • composer require --dev phuocqn/fillable:dev-master

功能

查看表列表

包括以下选项

  • 默认:将显示数据库中表的名字及其编号
  • 大写:将表名转换为大写并显示编号
  • 常量:将生成包含 const 的声明语句
  • 定义:将生成包含 define 的声明语句

对应选项的命令

  • php artisan table:show-list 或者 php artisan table:show-list default
  • php artisan table:show-list upper
  • php artisan table:show-list const
  • php artisan table:show-list define

每个选项对应的结果

  • 默认:1. users
  • 大写:1. USERS
  • 常量:const TABLE_USERS = 'users';
  • 定义:define('TABLE_USERS', 'users');

查看一个表的字段列表

运行命令

  • php artisan table:show-field <table_name>

示例

  • php artisan table:show-field users

注意

在某些情况下,如果出现与命令名'table'相关的错误,请运行以下命令来更新类加载:

  • composer dump-autoload