mercredi 28 décembre 2016

How to search all posts belongs to a tag in laravel

Article Model

class Article {
    public function Tag(){
      return $this->belongsToMany('App\Tag');
    }
}

Tag Model

class Tag {
    public function Article(){
      return $this->belongsToMany('App\Article');
    }
}

pivot table

article_id === tag_id

I want to search all books use a tag's name,how can I do this?



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

Aucun commentaire:

Enregistrer un commentaire