I have two tables Songs (belongsTo App\Host) and Hosts (hasMany App\Song). My Songs table has an attempts
column and my Host table has a skip_threshold
. I would like to query out all Songs that have not met its related Host's skip threshold.
How can I do this?
I have tried something like this:
return $songs = Song::whereIn('host_id', $available_hosts)
->where('attempts', '<', $songs->host->skip_threshold)->get();
I've attempted to make use of Eloquent relationship querying, but from testing I see this won't work. I would like to try and use Eloquent to do this so I can take advantage of eager loading related data in my blade templates.