Laravel nested loop

Source: Internet
Author: User
Currently, this requirement is similar to that of second-level navigation. now there is a group of big tables and a group of small-class tables; when the loop category is different, it loops through the current large category of small category EloquentORM. how can we associate the two tables? {code ...} how is this loop... currently, this requirement is similar to that of second-level navigation.

There are now a group of big-class tables and a group of small-class tables. when the cycle is large, the small-class tables in the current big category are cyclically typed.

How does Eloquent ORM work? how do we associate two tables?

In addition

@foreach ($users as $user)    

This is user {{ $user->id }}

@endforeach

How can we create multiple nested loops in such a loop?

I did this.

The category data is $ type.
The small data type is $ types.

 @foreach($type as $t)            
  
  
    {{$t->btype_name}}
@foreach($types as $ts) @if (count($t->id) ===count($ts->id))
  • {{$ts->stype_name}}
  • @endif @endforeach@endforeach

    It seems that all of them are out of the loop and not just small classes in the current category.

    Reply content:

    Currently, this requirement is similar to that of second-level navigation.

    There are now a group of big-class tables and a group of small-class tables. when the cycle is large, the small-class tables in the current big category are cyclically typed.

    How does Eloquent ORM work? how do we associate two tables?

    In addition

    @foreach ($users as $user)    

    This is user {{ $user->id }}

    @endforeach

    How can we create multiple nested loops in such a loop?

    I did this.

    The category data is $ type.
    The small data type is $ types.

     @foreach($type as $t)            
      
      
      {{$t->btype_name}}
    @foreach($types as $ts) @if (count($t->id) ===count($ts->id))
  • {{$ts->stype_name}}
  • @endif @endforeach@endforeach

    It seems that all of them are out of the loop and not just small classes in the current category.

    I think your code is faulty. Recently I am also reading lava5
    Very good tool. Think PHP was used all the time. Compared. Think PHP does not work.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.