| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public static function getStructureCategories(){ |
||
| 14 | |||
| 15 | $categories = Category::with('children')->whereNull('parent_id')->get(); |
||
| 16 | $tree = []; |
||
| 17 | foreach($categories as $category){ |
||
| 18 | $tree[] = [ |
||
| 19 | 'id' => $category->id, |
||
| 20 | 'text' => $category->name, |
||
| 21 | 'state' => ['opened'=>true], |
||
| 22 | 'children' => self::recursiveChildren($category->children) |
||
| 23 | ]; |
||
| 24 | } |
||
| 25 | return $tree; |
||
| 26 | } |
||
| 61 |