Example #1
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'));
 }