0

Why does the following code return the exception "Call to a member function where() on a non-object"?

SomeModel::find( $id )->where('name', $name);
4

1 回答 1

3

因为

SomeModel::find( $id );

返回一个模型,而不是 Query Builder 实例,它是查询的结尾。

你必须做

SomeModel::where('name', $name)->where('somethingElse', '=', 'value')->first();
于 2013-10-24T23:22:11.247 回答