Exemplo n.º 1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $menu = $this->menu->findOrFail($id);
     $pages = Page::active()->get();
     $categories = Category::withDepth()->defaultOrder()->descendantsOf(1)->linkNodes();
     return view('berrier::admin.menus.edit')->with(compact('menu'))->with(compact('pages'))->with(compact('categories'));
 }
Exemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $widget = $this->widget->findOrFail($id);
     $pages = Page::lists('title', 'id')->toArray();
     return view('berrier::admin.widgets.edit')->with(compact('pages'))->with(compact('widget'));
 }
Exemplo n.º 3
0
function beautifyMenuitems($menuitems)
{
    if (!$menuitems) {
        return array();
    }
    foreach ($menuitems as $item) {
        $split = explode(':', $item->id);
        $item->title = '';
        switch ($split[0]) {
            case 'Page':
                $item->title = \Wislem\Berrier\Models\Page::where('id', '=', $split[1])->first()->title;
                break;
            case 'Category':
                $item->title = \Wislem\Berrier\Models\Category::where('id', '=', $split[1])->first()->name;
                break;
            case 'Url':
                $url_attributes = explode('|', $split[1] . $split[2]);
                $item->title = $url_attributes[1];
                break;
            default:
                break;
        }
        if (isset($item->children)) {
            $item->children = beautifyMenuitems($item->children);
        }
    }
    return $menuitems;
}
Exemplo n.º 4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $widget = $this->widget->findOrFail($id);
     $pages = Page::join('page_translations as t', 't.page_id', '=', 'pages.id')->lists('title', 'id')->toArray();
     $posts = Post::join('post_translations as t', 't.post_id', '=', 'posts.id')->lists('title', 'id')->toArray();
     $categories_tree = Category::withDepth()->defaultOrder()->descendantsOf(1)->linkNodes();
     $categories = renderTreeToOptions($categories_tree);
     return view('berrier::admin.widgets.edit')->with(compact('pages'))->with(compact('categories'))->with(compact('posts'))->with(compact('widget'));
 }