public function myReferals(int $user_id): array
{
$refer = User::query()->where('ref_id', $user_id)->select(['id', 'name', 'created_at'])
->paginate(20);
$data = [];
foreach ($refer->items() as $key => $item) {
$number = $refer->firstItem() + $key;
$data[] = [
'number' => $number,
'id' => $item->id,
'name' => $item->name,
'data' => AdminService::parseCarbonDateFormat($item['created_at']),
];
}
$refer = $refer->toArray();
$refer['data'] = $data;
return AdminService::returnSuccess([
'status' => 'success',
'data' => $refer,
]);
}