An example from the documentation:
$posts = App\Post::whereHas('comments', function ($query) {
$query->where('content', 'like', 'foo%');
})->get();
This will look for posts that has at least one comment with foo
. It will return the post model with all comments. Is there a way to restrict this to return post model and related comments that only have foo
?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire