PHP-Laravel foreach only loops once

QuestionsPHP-Laravel foreach only loops once
sethbeckerman5 Staff asked 4 years ago

I have a categories table with parent_id column, referring to parent category's ID. I need to retrieve all of the ID's that are under a certain category (all of its children & grandchildren) I wrote this recursive function but for some reason it only returns the direct children of the given category id.
What am I missing here?


View on Stack Overflow