I am making a registration system with reference. Everything works fine so far, but there’s a point I’m stuck on.
First of all, anyone who is a member can invite someone. The person who accepts the invitation can register with the reference code of the person who sent the invitation.
However, there is such a situation in the system. Person A invited person B, person B invited person C. There are three people in the system.
When person A enters the panel, she should be able to see people B and C in the guest list.
This list will go on and on, the more foreach loops I add to the foreach loop, the more people in the lower row I can reach. How can I design this loop until I get to the last person?
My example foreach loop:
@php $leg = AppModelReference::where(['user_id' => $reference->worker_id])->get(); @endphp
@foreach($leg as $user)
{{ $user->user->name }}
@php $leg = AppModelReference::where(['user_id' => $user->worker_id])->get(); @endphp
@foreach($leg as $user)
{{ $user->user->name }}
@endforeach
@endforeach