$keywords = new Keyword(); $keywords->include_related_count('image'); $keywords->where('image_count <', 3); $keywords->get();