Guest User

Untitled

a guest
Jul 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. if ($comment['posted_by'] == $authUser['id']) {
  2. $data = $post->update([
  3. "comments.$key.description" => $dataArray['description'],
  4. "comments.$key.updated_at" => $dataArray['updated_at'],
  5. ]);
  6. }
  7.  
  8. $post = Post::where('_id', $id)->where('comments.*.id', $commentId)->update(array('description' => $desc));
  9.  
  10. if ($subCommentId) {
  11. foreach ($comment as $nestedkey => $nestedComments) {
  12. if ($nestedComments['id'] === $subCommentId && $nestedComments['posted_by'] == $authUser['id']) {
  13. $data = $post->update([
  14. "comments.$key.$nestedkey.description" => $dataArray['description'],
  15. "comments.$key.$nestedkey.updated_at" => $dataArray['updated_at'],
  16. ]);
  17. }
  18. }
  19. }
  20.  
  21. $post = Post::where('_id', $id)->where('comments.*.id', $commentId)->where('comments.*.*.id', $subCommentId)->update(array('description' => $desc));
Add Comment
Please, Sign In to add comment