|
@@ -14,6 +14,7 @@ use App\Models\SubtopicModerator;
|
|
|
use App\Models\SubtopicSubscriber;
|
|
|
|
|
|
use App\Http\Requests\NewPostRequest;
|
|
|
+use App\Http\Requests\NewCommentRequest;
|
|
|
|
|
|
class PostController extends Controller
|
|
|
{
|
|
@@ -64,7 +65,17 @@ class PostController extends Controller
|
|
|
//return redirect()->route('show_post',['sub' => $request->input('sub')],['post_id' => $post->post_id_string]);
|
|
|
return redirect()->route('main');
|
|
|
}
|
|
|
- //public function storeNewComment(New)
|
|
|
+
|
|
|
+ public function storeNewComment(NewCommentRequest $request){
|
|
|
+ $comment = new Comment;
|
|
|
+ $comment->content = $request->input('content');
|
|
|
+ $comment->userName = Auth::user()->name;
|
|
|
+ $comment->subwroteitID = $request->input('sub');
|
|
|
+ $comment->postID = $request->input('postID');
|
|
|
+ $comment->save();
|
|
|
+
|
|
|
+ return redirect()->route('show_post',['sub' => $request->input('sub'),'post_id' => $request->input(post_id_string)]);
|
|
|
+ }
|
|
|
|
|
|
public static function generateFancyPostID(string $sub,string $title){
|
|
|
$vanilla=$title;
|