/** * 文章详情. * * @param $id * * @return mixed */ public function detail($id) { $article = $this->postRepository->find($id); $prevId = $id > 1 ? $id - 1 : 1; $nextId = $id > 1 ? $id - 1 : 1; return user_view('docment.detail', compact('article', 'prevId', 'nextId')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $post = $this->postRepository->find($id); if (!$post) { return $this->respondNotFound(); } return $this->respond(['post' => $this->postTransformer->transform($post)]); }
/** * Show the form for editing the specified resource. * * @param int $id * * @return \Illuminate\View\View */ public function edit($id) { $post = $this->posts->find($id); return view('backend.posts.edit', compact('post')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $this->repository->find($id)->delete(); return redirect()->route('admin.post.index'); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $post = $this->repository->find($id); return view('posts/post', compact('post')); }