public function getPost(Request $request, $postId) { $post = Post::find($postId); return view('frontends.post')->with('post', $post); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $this->validate($request, ['title.de' => 'required', 'title.en' => 'required', 'identifier.de' => 'required', 'identifier.en' => 'required']); $post = Post::find($id); foreach (LaravelLocalization::getSupportedLocales() as $locale => $data) { $post->translateOrNew($locale); $post->translate($locale)->title = $request->title[$locale]; $post->translate($locale)->identifier = $request->identifier[$locale]; $post->translate($locale)->content = $request->content[$locale]; } $post->save(); return back(); }
public function preview(Request $request, $id) { $post = Post::find($id); return view('backends.posts.preview')->with('post', $post); }