Answer the question
In order to leave comments, you need to log in
How to pull all active articles and their active reviews (where the status is 1)?
There are two tables posts && reviews, the tables are respectively connected: one to many. Each table has a field status (0 || 1)
I know how to pull all active articles (posts) and for each article all reviews (reviews): Post::where('status', 1)->with('reviews')->get();
But I need to pull all active articles and their reviews in which the status is also 1
. is it possible to write such a query using eloquent and how to do it right?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question