Ejemplo n.º 1
0
 public function anyDetail($id)
 {
     $blogs = Blogs::find($id);
     $relate_blogs = Blogs::limit(3)->get();
     $comments = $blogs->comments;
     return view("news.detail")->withBlogs($blogs)->withComments($comments)->withRelateBlog($relate_blogs);
 }
Ejemplo n.º 2
0
 public function postIndex(Request $request)
 {
     if (!$request->input("id")) {
         return;
     }
     $rs = Blogs::find($request->input("id"));
     return json_encode($rs);
 }
Ejemplo n.º 3
0
 public function show($id)
 {
     $rs = Blogs::find($id);
     if (!$rs) {
         echo json_encode(["blog_title" => "Not found", "blog_content" => "Not found"]);
         return;
     }
     $comment = Comment::where("comment_blogs_id", $id)->get();
     echo json_encode(["blog_title" => $rs->blog_title, "blog_content" => $rs->blog_content]);
     die;
 }
Ejemplo n.º 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (Blogs::find($id)->delete()) {
         return redirect($this->prefix_redirect . '/blogs/');
     }
 }