本文介绍了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()不起作用
发布评论