【发布时间】:2012-12-14 03:00:07
【问题描述】:
我正在尝试创建名为 CustomDataStore (models/custom_data_store.php) 的模型,它正在扩展 Eloquent,因此表被命名为 custom_data_stores,但它给了我错误。
Eloquent 想要名为 customdatastores 的表。当然我可以手动设置表名,但是如何自动设置这样的名称呢?
【问题讨论】:
-
这是 Laravel 命名约定。如果您不喜欢它,也许您可以使用自定义表名解析扩展核心 Eloquent 模型,以便与您的其他模型一起使用。它在
laravel/database/eloquent/model.php中的table()方法中