【问题标题】:Laravel Nova - How to turn off auto-pluralization of tables in Dashboard?Laravel Nova - 如何关闭仪表板中表格的自动复数?
【发布时间】:2021-12-14 16:50:29
【问题描述】:

当我创建一个表about 并将其链接到Nova 时,在仪表板中它将显示为abouts。有没有办法关闭pluralization

额外问题:仪表板中的table names 可以与他们的table 分离并进行自定义吗?

编辑:

@Drown 的回答到目前为止有效,现在仪表板中的table names 正确显示为donate,但是当我点击table name 时,我得到了这个:

local.ERROR: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'stuttard_db.donates' doesn't exist (SQL: select * from `donates` order by `donates`.`id` desc limit 26 offset 0) {"userId":1,"exception":"[object] (Illuminate\\Database\\QueryException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'stuttard_db.donates' doesn't exist (SQL: select * from `donates` order by `donates`.`id` desc limit 26 offset 0) at C:\\Users\\Artur\\PhpstormProjects\\stuttard.de\\vendor\\laravel\\framework\\src\\Illuminate\\Database\\Connection.php:703)

此外,url 显示为http://localhost:3000/nova/resources/donates

我已经在Controller 中更新了table name。我想这是我手动输入table name的唯一地方。

【问题讨论】:

    标签: laravel laravel-nova


    【解决方案1】:

    您可以使用label()singularLabel() 方法来定义应该使用的文本

    文档链接:https://nova.laravel.com/docs/3.0/customization/localization.html#resources

    【讨论】:

    • 谢谢。您能看一下编辑部分吗?
    猜你喜欢
    • 2019-06-22
    • 2019-03-27
    • 2011-10-16
    • 1970-01-01
    • 2019-02-16
    • 1970-01-01
    • 1970-01-01
    • 2011-06-14
    • 2023-04-04
    相关资源
    最近更新 更多