mardi 29 novembre 2016

Display tags in article based on language?

This is my relationship:

article:

  public function tags(){
        return $this->belongsToMany('App\Models\ATags', 'article_tags','article_id', 'article_tag_id');
    }

language:

  public function tags(){
        return $this->hasMany('App\Models\ATags', 'language_id');
    }

Here i get all tags for specific language. I want now to display all tags for that language for that specific article.

foreach($languages as $language){
        $tags[] = $language->tags;
      }

Any suggestion how can i do that?



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

Aucun commentaire:

Enregistrer un commentaire