3 years ago

Nested eager loading with constraint not working

Posted 3 years ago by jay_gorio

I am having hard time using nested with with constraint. Can someone help me to group subjects based on the what semester it will be offered.


    public function show($id)
        $student = Student::with(['course', 'course.curriculum', 'course.curriculum.subjects' => function($query){

        return view('students.show', compact('student'));


@foreach($student->course->curriculum->subjects['first first-sem'] as $subject)
    <td>{{ $subject->subject_code }}</td>
    <td>{{ $subject->subject_description }}</td>
    <td>{{ $subject->units }}</td>

Please sign in or create an account to participate in this conversation.