Example #1
0
 public static function htmlTree()
 {
     $folder = new self();
     return '<ol class="dd-list">' . $folder->_getTreeData(AssetsFolder::where('parent_id', '=', 0)->orderBy('position')->get()) . '</ol>';
 }
Example #2
0
 private function _updateTreeItemPosition($childs, $parentId)
 {
     $pos = 0;
     foreach ($childs as $item) {
         AssetsFolder::find($item['id'])->update(['position' => $pos, 'parent_id' => $parentId]);
         if (key_exists('children', $item)) {
             $this->_updateTreeItemPosition($item['children'], $item['id']);
         }
         $pos++;
     }
 }