/** * 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); }
/** * 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()]); }