function display_children($parent, $level) {
$count = 0;
$result = mysql_query('SELECT user_id FROM sponsers '.'WHERE parent_id="'.$parent.'"');
while ($row = mysql_fetch_array($result))
{
$var = str_repeat(' ',$level).$row['user_id']."
";
//echo $var after remove comment check tree
// i call function in while loop until count all user_id
$count += 1 +$this->display_children($row['user_id'], $level+1);
}
return $count; // it will return all user_id count under parent_id
}
Here is my code. I need some help in how will I implement in laravel concept because I'm doing in php concept.
Please help me out. Someone able to share or modified code using laravel 4.2 version