Skip to content

Commit

Permalink
Make sure parent object is in synced
Browse files Browse the repository at this point in the history
  • Loading branch information
luuhoangnam committed Mar 22, 2015
1 parent a425576 commit f40eb7d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Realtime/Receiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ private function processCommentChanges($value)
case 'add':
$postId = $value->parent_id;

$post = Post::findOrSync($postId);
/** @var Post $post */
$post = Post::find($postId)->sync();
$comment = Comment::findOrSync($commentId);

$post->comments()->save($comment);
Expand Down Expand Up @@ -153,7 +154,9 @@ private function processStatusChanges($value, $pageId)
case 'add':
$postId = $value->post_id;

$page = Page::findOrSync($pageId);
/** @var Page $page */
$page = Page::find($pageId)->sync();
/** @var Post $post */
$post = Post::findOrSync($postId);

$page->posts()->save($post);
Expand Down

0 comments on commit f40eb7d

Please sign in to comment.