如何解决Laravel中的唯一表/别名错误?

发布于 01-19 05:18 字数 213 浏览 3 评论 0原文

我对 laravel 非常陌生,我正在使用 l5-repository 包进行 orderBy 和 SortedBy 来对列进行排序,在点击 API 时我收到以下错误,请帮助我解决问题

我的 API URL :-http://localhost.com /v1/domain?limit=250&page=1&orderBy=users|name&sortedBy=desc

I am very new to the laravel,i am using l5-repository package for orderBy and sortedBy to sort columns ,while hitting API i am getting following error please help me to resolve the issue

my API URL :-http://localhost.com/v1/domain?limit=250&page=1&orderBy=users|name&sortedBy=desc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开半夏魅人心2025-01-26 05:18:44

您的表名称中有一个错误。默认情况下,Laravel将寻找cards的表名,用于card的模型。另外,看看您的模型名称。我可以察觉到您错误概念card.php,因为它应该是card.php。 Laravel使用了许多PSR惯例和雄辩(处理关系和这些东西)。如果您不太了解它,请查看如何命名课程。正如Alireza所说,看看Laravel的文档,这是很棒而完整的。当您拥有一对多房地产时,其中一个应该具有Hasmany(...)而不是

You probrably have an error in your table name. For default, laravel will look for cards table name for a model named Card. Also, take a look in your models name. I espect you misstype card.php because it should be Card.php. Laravel uses a lot of psr convention and Eloquent (who deal with relationships and that stuff). If you are not well versed into it, take a look in how to name classes. As Alireza said, take a look in the Laravel's documentation, it is awesome and complete. When you have a one to many realtionship, one of they should have a hasMany(...) instead belongsTo(....)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文