2 years ago

How do I use associate in Laravel.

Posted 2 years ago by kingashok29

Hello, I am building a blog and I want to save comments and replies on a post by using Eloquent. I used proper relationships on all models. But now it is giving me error that user_id does not has a default value. So how do i add a comment on post by just passing comment-body parameter from request and filling post-id and user-id from eloquent automatically.

Please sign in or create an account to participate in this conversation.