Reputation: 512
Why does the following code return the exception "Call to a member function where() on a non-object"?
SomeModel::find( $id )->where('name', $name);
Upvotes: 0
Views: 426
Reputation: 87719
Because
SomeModel::find( $id );
Returns a model, not a Query Builder instance, it's the end of the query.
You must do
SomeModel::where('name', $name)->where('somethingElse', '=', 'value')->first();
Upvotes: 3