/**
  * @param PageRepository $repository
  * @param int        $parentId
  * @param int        $level
  *
  * @return null|string
  */
 protected function _children(PageRepository $repository, $parentId, $level)
 {
     $expandedRows = UserMeta::get('expanded_pages', []);
     $page = $repository->find($parentId);
     if (is_null($page)) {
         return;
     }
     $children = $repository->getChildrenByPageId($parentId);
     foreach ($children as $id => $child) {
         $children[$id]->hasChildren = $child->hasChildren();
         $children[$id]->isExpanded = in_array($child->id, $expandedRows);
         if ($children[$id]->isExpanded === true) {
             $children[$id]->childrenRows = $this->_children($repository, $child->id, $level + 1);
         }
     }
     return view('pages::pages.children', ['children' => $children, 'level' => $level + 1])->render();
 }
예제 #2
0
 protected function _children($parent_id, $level)
 {
     $expandedRows = UserMeta::get('expanded_pages', []);
     $page = Page::find($parent_id);
     if (is_null($page)) {
         return NULL;
     }
     $query = Page::where('parent_id', $parent_id)->orderBy('position', 'asc')->orderBy('created_at', 'asc');
     $childrens = $query->get()->lists(NULL, 'id');
     foreach ($childrens as $id => $child) {
         $childrens[$id]->hasChildren = $child->hasChildren();
         $childrens[$id]->isExpanded = in_array($child->id, $expandedRows);
         if ($childrens[$id]->isExpanded === TRUE) {
             $childrens[$id]->childrenRows = $this->_children($child->id, $level + 1);
         }
     }
     return (string) view('pages::pages.children', ['childrens' => $childrens, 'level' => $level + 1]);
 }
 public function getData()
 {
     $key = $this->getRequiredParameter('key');
     $user_id = $this->getParameter('uid');
     $this->setContent(UserMeta::get($key, [], $user_id));
 }
 /**
  * @param null|int $userId
  *
  * @return array
  */
 protected function getSettings($userId = null)
 {
     return UserMeta::get(self::WIDGET_SETTINGS_KEY, [], $userId);
 }
예제 #5
0
 public function getCurrentTheme()
 {
     return UserMeta::get('cms_theme', config('cms.theme.default'), $this->id);
 }