|
@@ -0,0 +1,97 @@
|
|
|
|
+<?php
|
|
|
|
+
|
|
|
|
+namespace App\Http\Controllers;
|
|
|
|
+
|
|
|
|
+use App\Comment;
|
|
|
|
+use App\Post;
|
|
|
|
+use Illuminate\Http\Request;
|
|
|
|
+
|
|
|
|
+class CommentsController extends Controller
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Show the form for creating a new resource.
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function create()
|
|
|
|
+ {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Remove the specified resource from storage.
|
|
|
|
+ *
|
|
|
|
+ * @param int $id
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function destroy($id)
|
|
|
|
+ {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Show the form for editing the specified resource.
|
|
|
|
+ *
|
|
|
|
+ * @param int $id
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function edit($id)
|
|
|
|
+ {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Display a listing of the resource.
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function index()
|
|
|
|
+ {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Display the specified resource.
|
|
|
|
+ *
|
|
|
|
+ * @param int $id
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function show($id)
|
|
|
|
+ {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Store a newly created resource in storage.
|
|
|
|
+ *
|
|
|
|
+ * @param \Illuminate\Http\Request $request
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function store(Post $post, Request $request)
|
|
|
|
+ {
|
|
|
|
+ $this->validate($request, ['body' => 'required|min:2']);
|
|
|
|
+ $post->addComment($request->get('body'));
|
|
|
|
+
|
|
|
|
+ // return redirect("/posts/{$post->id}");
|
|
|
|
+ return back();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Update the specified resource in storage.
|
|
|
|
+ *
|
|
|
|
+ * @param \Illuminate\Http\Request $request
|
|
|
|
+ * @param int $id
|
|
|
|
+ *
|
|
|
|
+ * @return \Illuminate\Http\Response
|
|
|
|
+ */
|
|
|
|
+ public function update(Request $request, $id)
|
|
|
|
+ {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|