Noob question: Sorting a hasMany column in table
I'm really struggle sorry and I am sure it is dead easy to do.
Apologies, I know I've asked a bunch of relation questions, but that seems to be where stuff explodes for me.
What I am trying to do:
I need the HIndex column in the Activities table to be sortable based on the related HIndex with the highest year value (or based on the formatted state would be even better)
Model Activity:
But it throws:
SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row
Apologies, I know I've asked a bunch of relation questions, but that seems to be where stuff explodes for me.
What I am trying to do:
I need the HIndex column in the Activities table to be sortable based on the related HIndex with the highest year value (or based on the formatted state would be even better)
Model Activity:
- has many HIndex via
- Belongs to one Activity
- Has the columns
-- year
-- value
-- activity_id
But it throws:
SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row