0👍
✅
The code itself is still good I just needed to change with I sent though as the parameter. I didn’t know that the model
it was asking for is basically just an object, so I just send through the object I wanted for the edit and reply and for the remove I just passed the id through and changed the post url from
this.$inertia.delete(this.baseUrl + '/' + row.id)
to
this.$inertia.delete(this.baseUrl + '/' + id)
I could’ve just sent the object through as well, as it would’ve taken the id when sending it anyway.
The button with the new parameters
<div class="btn-link-preview action-button"
@click="openReply(comment)">
<i class="fas fa-reply"></i>
</div>
<div class="btn-link-edit action-button"
@click="edit(comment)">
<i class="fas fa-pencil-alt"></i>
</div>
<div class="btn-link-delete action-button"
@click="remove(comment.id)">
<i class="fas fa-trash"></i>
</div>
This is what is inside comment
without replies, and the object I send though
{
"id":8,
"user_id":24,
"discussion_forum_id":1,
"parent_id":null,
"comment":"adsfadsfasdf",
"comment_time":"2019-12-03 14:55:09",
"created_at":null,
"updated_at":null,
"user":{
"id":24,
"name":"Vinny Ridley",
"card":"12353",
"scard":"97524",
"user_type_id":4,
"email":"v@email.com",
"created_at":"2019-12-02 13:07:37",
"updated_at":"2019-12-02 13:07:37"
},
"replies":[
]
}
For editing and deleting a reply I just send reply
or reply.id
and that does it. Hope this helps someone with the same or similar issue.
Source:stackexchange.com