If you have two models Post and Comment, and in the Comment model you have defined a belongsTo(), relationship called posts, I know that it is possible to do this:
App\Comment::find(1)->posts()->where('category', 3)->get()
But what I want is to pass more than one primary key id to the method find like:
App\Comment::find([1,2,3])->posts()->where('category', 3)->get()
Or
App\Comment::findMany([1,2,3])->posts()->where('category', 3)->get()
These two gives me the error method posts does not exist
. So how else can I handle this problem?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire