0
How do I Show My Direct Referrals Indirect? In the case of the image, this is my Direct Nominee but below it there are some Indirect. No way I’m able to solve, Someone to give a light?
Follow an excerpt from my PHP
public function getIndicados($id = '') {
if ($id == '') {
$id = Auth::user()->id;
}
$reffer = Referrals::where('pai_id', $id)->get();
$users = array();
foreach ($reffer as $key => $r) {
$users[$key] = $this->where('id', $r->user_id)->first();
}
return $users;
}
public function getFilhos($id = null, $count = false) {
if (!$id) {
$id = $this->id;
}
$reffer = Referrals::where('system_id', $id)->orderBy('direcao', 'ASC')->get();
$users = array();
foreach ($reffer as $key => $r) {
$user = $this->where('id', $r->user_id)->first();
$user->direcao = $this->getUserDirection($r->user_id);
$users[$key] = $user;
}
if ($count) {
return count($users);
}
return $users;
}
And My HTML
<table id="example2" class="table table-bordered table-hover">
<thead>
<tr>
<th>Nome</th>
<th>Email</th>
<th>Telefone</th>
<!-- <th>Direção binária</th> -->
<th>Situação</th>
<th>Investimento</th>
<th>Graduação</th>
</tr>
</thead>
<tbody>
@inject('usuarios', 'App\User') @foreach($usuarios->getIndicados() as $user)
<tr>
<td><b>{{$user->name}}</b></td>
<td>{{$user->email}}</td>
<td>{{$user->telefone}}</td>
<td>{{$user->getStatus()}}</td>
<td>{{$user->getPacote()->nome}}</td>
<td>{{$user->minhaGraduacao()}}</td>
</tr>
@endforeach
</tbody>
</table>
As for Indirect and Direct, I didn’t understand what each one would be
– hugocsl
Would be the referred of the said ex: you signed up and received a referral link, that link another person register and is below you giving you commission, but in this case is already ready, I just really want to show who is below my referred
– Atila Oliveira
In case the picture, this person is below me, but she has another below her that n is appearing
– Atila Oliveira