예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Page $page, $templateblock, WidgetnodeRequest $request)
 {
     $data = $request->all();
     $data['templateblock_id'] = $templateblock->id;
     $page->nodes()->create($data);
     return redirect()->route('zxadmin.page.edit', [$page->id, $templateblock->identifier]);
 }
예제 #2
0
파일: PageService.php 프로젝트: zedx/core
 /**
  * Display the specified resource.
  *
  * @param int $id
  *
  * @return Response
  */
 public function show($shortcut = '/', $integrateCorePages = false)
 {
     if ($shortcut != '/') {
         $page = Page::shortcut($shortcut, $integrateCorePages)->firstOrFail();
     } else {
         $page = Page::home()->firstOrFail();
     }
     $__zedx_template_blocks = $this->blocks($page);
     $__themePartials = $page->themepartials->lists('name')->toArray();
     return ['templateFile' => $page->template->file, 'data' => compact('page', '__themePartials', '__zedx_template_blocks')];
 }
예제 #3
0
 protected function create($name, $shortcut, $description, $is_home)
 {
     return Page::create(['name' => $name, 'shortcut' => $shortcut, 'description' => $description, 'is_home' => $is_home, 'template_id' => Template::first()->id]);
 }
예제 #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param Page $page
  *
  * @return Response
  */
 public function destroy(Page $page)
 {
     if ($page->type != 'page') {
         return abort();
     }
     $page->delete();
 }
예제 #5
0
 protected function create($templateIdentifier, $name, $type, $shortcut, $description)
 {
     return Page::create(['name' => $name, 'type' => $type, 'shortcut' => $shortcut, 'description' => $description, 'template_id' => Template::whereIdentifier($templateIdentifier)->first()->id]);
 }
예제 #6
0
파일: helpers.php 프로젝트: zedx/core
 /**
  * Render Menu.
  *
  * @param string/Menu $groupName
  * @param array       $config
  *
  * @return void
  */
 function renderMenu($groupName, $config = [], $first = true)
 {
     $render = '';
     if (is_string($groupName)) {
         $nested = Menu::whereGroupName($groupName)->orderBy('lft')->get();
         if (!$nested) {
             return;
         }
         $menus = $nested->toHierarchy();
     } else {
         $menus = $groupName;
     }
     foreach ($menus as $menu) {
         if ($menu->type == 'page') {
             $page = Page::find($menu->link);
             $url = $page ? route('page.show', $page->shortcut) : '#';
         } elseif ($menu->type == 'route') {
             $url = Route::has($menu->link) ? route($menu->link) : '#';
         } else {
             $url = starts_with($menu->link, '/') ? url($menu->link) : $menu->link;
         }
         $active = url()->current() == $url ? 'active' : '';
         $hasChildren = $menu->children()->count() > 0;
         $element = $first ? 'parent' : 'children';
         $attrType = $hasChildren ? 'withChildren' : 'withoutChildren';
         $li = str_replace('{active}', $active, array_get($config, $element . '.li.' . $attrType, 'class="{active}"'));
         $liChildren = array_get($config, $element . '.liChildren');
         $link = array_get($config, $element . '.link.' . $attrType);
         $ul = array_get($config, $element . '.ul');
         $caret = $hasChildren ? array_get($config, $element . '.angle', '<span class="caret"></span>') : '';
         $render .= '<li ' . $li . '>' . '  <a href="' . $url . '" ' . $link . '>' . '    <i class="' . $menu->icon . '"></i> ' . $menu->name . ' ' . $caret . '  </a>';
         if ($hasChildren) {
             $render .= '<ul ' . $ul . '>';
             $render .= renderMenu($menu->children, $config, false);
             $render .= '</ul>';
         }
         $render .= '</li>';
     }
     return $render;
 }