Example #1
0
 /**
  * Page form
  * @param int $page_id
  */
 public function getIndex($page_id = 0)
 {
     User::onlyHas("page-view");
     if ($page_id) {
         $this->data['page'] = Post::findTax($page_id, $this->taxonomy->id);
         if ($this->data['page']) {
             $this->data['view_mods'] = Template::getViewMethodList('page');
             $this->data['page_langs'] = $this->data['page']->langs()->get();
             $this->data['page_properties_all'] = PostProperty::where('taxonomy_id', 1)->orderBy('name', 'asc')->get();
             $properties = PostPropertyRel::where('post_id', $page_id)->get();
             $this->data['page_properties'] = [];
             foreach ($properties as $property) {
                 $this->data['page_properties'][] = $property->post_property_id;
             }
         }
     }
     $this->data['tree_pages'] = Post::tree($this->taxonomy->id);
     View::share($this->data);
     $this->layout->content = View::make('sections.page.layout');
 }