Laravel 4:Eloquent :: find()不起作用

编程入门 行业动态 更新时间:2024-10-20 05:42:28
本文介绍了Laravel 4:Eloquent :: find()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

所以我有一个简单的,空洞的Eloquent类: class Worker extends Eloquent {} 。 然后在控制器我写: Worker :: find(1); ,我收到一个异常,说SQL是不正确的:

So I have a simple, empty Eloquent class: class Worker extends Eloquent {}. Then in the controller I write: Worker::find(1); and I get an exception, saying that the SQL is incorrect:

select * where `id` = ?

显然,从SQL子句丢失。

Obviously, the from SQL clause is missing.

哦,我今天下载了这个应用程序的Laravel 4。

Oh, I downloaded the Laravel 4 for this app today.

推荐答案

在Laravel 4中,你必须设置一个表属性

In Laravel 4 you have to set a table property

protected $ table ='foo';

更多推荐

Laravel 4:Eloquent :: find()不起作用

本文发布于:2023-10-26 18:50:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531039.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   Laravel   Eloquent   find

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!