public function saveNavigation(Resource $resource, Node $baseNode = null)
 {
     $container = Container::whereName('admin')->first();
     $pages = $resource->pages;
     foreach ($pages as $page) {
         $node = new Node();
         $node->title = $page->title;
         $node->page()->associate($page);
         $node->container()->associate($container);
         $node->save();
         if (trim($page->route, '/') == $resource->url) {
             $root = $node;
             if ($baseNode) {
                 $root->makeChildOf($baseNode);
             }
         } else {
             $node->makeChildOf($root);
         }
     }
 }
示例#2
0
 /**
  * @return Container
  */
 public function getContainer()
 {
     return Container::whereName('dashboard')->first();
 }