vendredi 17 février 2017

Two relationships in one query?

What i need is somehow to join those two queries so that i get all articles with translations with $cur_language and where('title','=',$property->district->district) that is in c_translations. Any suggestion how can i do that?

      $guides = $article->translations()->whereHas('language',function($query) use($cur_language){
        $query->where('id','=',$cur_language);
      })->first();

      $guides = $article->category->c_translations()->whereHas('language',function($query) use($cur_language){
        $query->where('language_id','=',$cur_language)->where('title','=',$property->district->district);
      })->first();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lq0AKk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire