Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Why does the following code return the exception "Call to a member function where() on a non-object"?
SomeModel::find( $id )->where('name', $name);
因为
SomeModel::find( $id );
返回一个模型,而不是 Query Builder 实例,它是查询的结尾。
你必须做
SomeModel::where('name', $name)->where('somethingElse', '=', 'value')->first();