Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function categoryTree($id)
- {
- $data='';
- $all_childs = \App\Models\Category::where('parent_id', $id)->get();
- if(!empty($all_childs))
- {
- echo "<ul>";
- foreach ($all_childs as $child)
- {
- echo "<li> <a href='#'>";
- echo $child->name .' '. $child->id ;
- echo "</a></li>";
- categoryTree($child->id);
- }
- echo "</ul>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement