/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Blog $blog) { $blogPosts = $blog->blogPost()->orderBy('id', 'desc')->get(); return view('blog.edit', compact('blog', 'blogPosts')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(BlogPostValidationRequest $request, Blog $blog) { $blogPost = new BlogPost($request->all()); $blog->blogPost()->save($blogPost); return Redirect::route('blog.blogPost.edit', ['blog' => getUrlForThisName($blog), 'blogPost' => getUrlForThisName($blogPost)]); }