So if I have models
Song
and
Writer
and Song has many Writers
And I want to query songs such that I only get songs where all its writers have a certain field that is true, what would my solution be?
The Laravel whereHas function will get all songs that have at least one writer with that field, like so.
Song::whereHas('writers', function($query){
$query->where('writerField', '=', true);
});
But what is the pure eloquent way to make sure EVERY writer related to a Song has that 'writerField' set to true?