Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after doing all it's fall ? the Model doesn't retrieve User object? #4

Open
Adamkaram opened this issue Apr 15, 2020 · 0 comments
Open

Comments

@Adamkaram
Copy link

12
13

my code
commednt Model

belongsTo('App\News'); } public function getRepliesCountAttribute() { return $this->replies->count(); } public function votes() { return $this->morphMany('App\Vote', 'voteable'); } public function user() { return $this->belongsTo('App\User'); } public function replies() { return $this->hasMany('App\Comment', 'comment_id')->whereNotNull('comment_id'); } } my code in vue js
{{ comment.user.name }}
{{ comment.body }}
{{ addingReply ? 'Cancel' : 'Add Reply' }}
Add reply
<script> import Avatar from 'vue-avatar' import Replies from './replies.vue' export default { components: { Avatar, Replies }, data() { return { body: '', addingReply: false } }, props: { comment: { required: true, default: () => ({}) }, video: { required: true, default: () => ({}) } }, methods: { addReply() { if (! this.body) return axios.post(`/comments/${this.video.id}`, { comment_id: this.comment.id, body: this.body }).then(({ data }) => { this.body = '' this.addingReply = false this.$refs.replies.addReply(data) }) } } } </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant