привет, как вывести sh новые данные в верхний список, используя vue. js и laravel, я пытался, но все еще не смог, я надеюсь, что кто-то может помочь с проблемой.
это мой контроллер
public function addComment()
{
$this->validate(request(), [
'comment' => 'required',
]);
$comment = [
'comment' => request()->comment,
'article_id' => request()->article_id,
'user_cid' => Auth::user()->user_cid,
];
$comment = ArticleComment::create($comment);
return new ArticleCommentResource($comment);
}
и это мой Vue. js метод
data() {
return {
data: [],
comments:[],
form: new Form({
comment: '',
article_id: this.articleid,
})
}
},
methods: {
onSubmit() {
this.showLoader = true
this.form.post('add-comment')
.then(response => {
console.log(response.article_id);
this.form.article_id = response.article_id;
});
},
}
как с этим справиться, спасибо
надеюсь кто-то может помочь