Cannot show value from pivot table in table builder column?
I have two models; User and Talent.
A belongsToMany relationship is defined on both models.
In the pivot table (talent_user) I have a column named 'score'.
I wan't to display this value next to the talent in a table. I cannot, however, figure out to display this pivot column value in the table.
Relevant code used to define the relationship and display the table is included in this gist: https://gist.github.com/ph1llips/66d233be355b1df2b0b23a5e71520552
Gist
How to show value from pivot column in table column
How to show value from pivot column in table column - Talent.php
2 Replies
If I'm reading this right, maybe this could work:
Or maybe it's a
$record->users
collection instead? In this case you would loop through and concatenate the scores.Ahh, couldn't find any reference in the docs for that method. That's exactly what I need. Thank you!