示例#1
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     // Retrieve all categories
     $categories = Category::all();
     // Bind them to view
     $view->with('categories', $categories);
 }
示例#2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  Post $post
  * @return Response
  */
 public function edit(Post $post)
 {
     return view('post.edit', ['post' => $post, 'categories' => Category::all()]);
 }