counts not working on relationship
I'm trying to add a column that shows a count of the related records. This code correctly displays JSON output of the related records, so I know it's getting them correctly, but counts() doesn't work.
This gets results from the relationship:
This fails with: Call to a member function goals() on null
Here are the relationships:
Where am I going wrong?
4 Replies
i dont think its a real relationship
if you have to go through ->mission
maybe you need a hasManyThrough() ?
I tried that, and it correctly displayed the count for one mission, but reported no records for the second, even though there are.
okay, well a real relationship is the way to go here
you need to work out whats wrong with the definition
it was a relationship issue, we worked things out π Thanks