0

I want to show all industries, major, and skills that belong to the selected user. I'm stuck with the syntax. this is my code. the first row is correct but all other rows i need to link the user. eg: $major->myUsers->mySkills as $skills

@foreach($user->myIndustries as $industry)
       <h4> {{ $industry->title }}</h4>  <br>
        @foreach( $industry->myMajors as $major)
           <B>{{ $major->title }} - </B>
            @foreach($major->mySkills->unique() as $skills)
                {{ $skills->name }}
            @endforeach
            <br>
            @endforeach()
    @endforeach
mmmsabeel
  • 35
  • 7

1 Answers1

0

Try this code:

@foreach($user->myIndustries as $industry)
   <h4> {{ $industry->title }}</h4>  <br>
    @foreach( $industry->myMajors as $major)
       <B>{{ $major->title }} - </B>
        @foreach($major->mySkills->unique() as $skills)
            {{ $skills->name }}
        @endforeach
        <br>
    @endforeach
@endforeach
Hanie Asemi
  • 1,318
  • 2
  • 9
  • 23