mercredi 28 décembre 2016

How to return articles if count is > 0?

I want to display only tags if have articles. Any suggestion how can i do this?

  $tags = ATags::with('articles')->whereHas('language',function($query) use($current_language_id) {
      $query->where('id','=',$current_language_id)->
    })->limit(8)
    ->get()
    ->sortByDesc(function($tag) {
        return  $tag->articles->count();
  });



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire