//for comment Section
//commentController.php
public function store(StoreCommentRequest $request)
{
//
$comment = Comment::create([
"message"=>$request->message,
"post_id"=>$request->post_id,
"user_id"=>Auth::id(),
]);
return redirect()->to(url()->previous()."#comment-create");
}
//Comment.php <= model
class Comment extends Model
{
use HasFactory;
protected $fillable =["message","user_id","post_id"];
}