public function downline()
{
if (Auth::user()->role == 'regular') {
$Underline = User::where('usernameSponsor', Auth::user()->usernameSponsor)->paginate(3);
return response()->json([
'data' => $Underline,
], 200);
} elseif (Auth::user()->role == 'marshall') {
$Underline = User::where('usernameSponsor', Auth::user()->usernameSponsor)->paginate(7);
return response()->json([
'data' => $Underline,
], 200);
} else {
return response()->json([
'message' => 'Anda Tidak Memiliki Downline',
], 404);
}
}
public function user($sponsor)
{
if (Auth::user()->role == 'regular') {
$user = User::where('usernameSponsor', $sponsor)->paginate(50);
return response()->json([
'data' => $user,
], 200);
} elseif (Auth::user()->role == 'marshall'){
$user = User::where('usernameSponsor', $sponsor)->paginate(100);
return response()->json([
'data' => $user,
], 200);
}
}