Example #1
0
 /**
  * $id category to searh progeny , $list array to use, $fields that you need
  */
 public static function progeny($id, &$list, $fields = ['id', 'name'])
 {
     $childs = Category::childsOf($id)->select($fields)->get();
     if (is_null($childs)) {
         return;
     }
     foreach ($childs as $value) {
         $list[] = $value->toArray();
         Category::progeny($value->id, $list, $fields);
     }
     return;
 }