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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire