예제 #1
0
 public static function getAllParentCategories($id, Collection &$collections)
 {
     $category = parent::find($id);
     if ($category instanceof self) {
         $collections->push($category);
         $parent = parent::where(['enabled' => true, 'id' => $category->parent_id])->first();
         if ($parent instanceof self) {
             static::getAllParentCategories($parent->parent_id, $collections);
             $collections->push($parent);
         }
     }
 }