Perhaps you should have a relationship,
#Course
public function assignments()
{
return $this->hasMany('App\Assignment');
}
Then you can query it something like;
$student = Student::with('courses', 'courses.assignments')->findOrFail($id)
Then the returned collection should contain the student record, their courses and the assignments of those courses.
You can then list the assignments with (or without) the course name
@forelse($student->courses as $course)
// display the course details
@forelse($course->assignments as $assignment)
//display the assignments for this course
@empty
<p>Yay, no assignments</p>
@endforelse
@empty
<p>Hey dude - get yourself a course already</p>
@endforelse
props to @codebyjeff for the @ forelse tip
*** UNTESTED ***