Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

boyjarv's avatar

422 Unprocessable Entity

{"message":"The given data was invalid.","errors":{"message":["The message field is required."]}}

Here is my created method, I just want to updated the updated_at date/time to today

created() {
    
    this.commentRead = {
        message: this.commentData.message,
        firstName: this.commentData.firstName,
        is_live: this.commentData.is_live,
        updated_at: this.currentDateTime()
      }
    console.log('commentRead: ', this.commentRead)
    let commentID = this.$route.params.comment_id
    this.getCommentData();
    this.$store.dispatch('comments/commentRead', { commentID }, this.commentRead )
  }
0 likes
2 replies
tykus's avatar

The 422 status code and message is coming from your Laravel application; what is happening between dispatching the action and the Request hitting your API?

dcranmer's avatar

It's a validation error. Check the value of the message field that is being sent to Laravel. Apparently it's empty, but it's a required field.

Please or to participate in this conversation.