$query = 'SELECT a.*, b.children AS childrens FROM pages AS a LEFT JOIN (SELECT parent, COUNT(id) as children FROM pages GROUP BY parent) AS b ON a.id = b.parent WHERE a.parent= 71'; DB::query($query)->execute();
It looks like you're new here. If you want to get involved, click one of these buttons!