Current logical setup:
- A room can have many objects.
- An object can have many numbers.
-- The problem is that the objects may/may not have any numbers.
Scenario: I want to retrieve only objects that have a number, based on the room_id I provide.
Attempted:
$audits = Room::where('id', $room_id)
->has('objects.scores')
->get();
What I'm finding is that it's returning all objects, even though only a couple of the objects actually have a score.
How I can query in reverse? Or the correct way! I only want objects that have a score associated with them, and consequently anything related to them (rooms etc..)
Many thanks.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l8wcnD
via IFTTT
Aucun commentaire:
Enregistrer un commentaire