Because there's is no query instance declared above.So $query is an empty variable right?. So you can directly call the model and apply where condition.
ModelName::whereIn('lead_owner_id', $ownerIds)->get();