in the place of manually establishing the post_id characteristic on the Comment model you may possibly place the remark utilizing the relationship’s conserve technique:
Keep in mind that we did not access the reviews relationship as a property that is dynamic. Rather, we called the remarks solution to get an example of this relationship. The salvage method will immediately add the correct post_id value to this new Comment model.