Reputation: 43
I have the following Models:
These are their relationships:
Tables:
I'm currently doing this, but want to get/show the grade name too of the upload, but not sure how?:
@foreach ($assessment->uploads as $upload)
{{ $upload }}
@endforeach
Upvotes: 1
Views: 225
Reputation: 11
Anyone struggling with converting legacy code to Laravel...when you need to join tables on multiple columns, I highly recommend using https://github.com/topclaudy/compoships!
I ran into this excellent code while reading an article here: Laravel Eloquent: multiple foreign keys for relationship
Upvotes: 1
Reputation: 610
I edited your question.
Make relation like i edited .
And then try this
@foreach ($assessment->uploads as $upload)
{{ $upload->grade->name }}
@endforeach
Upvotes: 2