Reputation: 93
im working on a gradebook software and i have a litte problem with the displaying of the grades.
I have typed in the following line in my view-file:
<p>{{!! $gradesArray = $user->grades !!}}</p>
But as result I got the whole Array in json-format:
{[{"id":"10","grade":"1.3","user_id":"6","course_id":"3","created_at":"2016-01-08 16:31:14","updated_at":"2016-01-08 16:31:14","deleted_at":null},{"id":"11","grade":"1.7","user_id":"6","course_id":"2","created_at":"2016-01-08 22:59:43","updated_at":"2016-01-08 22:59:43","deleted_at":null},{"id":"12","grade":"2.0","user_id":"6","course_id":"1","created_at":"2016-01-09 13:26:09","updated_at":"2016-01-09 13:26:09","deleted_at":null}]}
What can I do to display only the grades and courses?
Upvotes: 0
Views: 41
Reputation: 523
@foreach($user->grades as $grade)
{{ $grade->grade }}
@endforeach
Upvotes: 1