made:model命令现在可以根据数据库中的表格生成model吗

xuhuangdev

webman/console的 made:model 命令 可以根据数据库中的表格并读取表格所有参数生成model吗
具体该怎么操作?
php webman make:model users 生成的model文件并没有生成所有参数,也没有把属性的备注加进去
users表有两个字段id,name
生成文件如下

<?php
namespace app\model;
use support\Model;
/**
 *
 */
class Users extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = null;

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;
}
339 1 0
1个回答

ersic

webman 也是可以的,但是参数得调整对

  • xuhuangdev 2023-07-31

    能给个例子吗

  • efnic 2023-08-01

    要正确配置数据库账号、密码、数据库名。

🔝