问答 / 0 / 3 / 创建于 4年前
项目的数据表已经是有的了,我是想用 LARAVEL 二次重构,遇到数据表名字有下划线,造成模型名字不一致的问题,麻烦大家啦,谢谢~
在表模型类中添加属性
protected $table = "表名";Copy
protected $table = "表名";
快速入门《Laravel 7 中文文档》
这种情况文档中都有说明的,细心点就好了
protected $table = "table_name";Copy
protected $table = "table_name";
其实你写大小写也是可以的,比如表名 user_roles 你的 model 就是 UserRole
我要举报该,理由是:
推荐文章: