Merge pull request #17 from the-turk/master

Fix notifications for [deleted] users
This commit is contained in:
Daniël Klabbers 2020-03-03 13:57:25 +01:00 committed by GitHub
commit ea60da9ee5
2 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ class SendNotificationWhenPostIsLiked
public function handle(PostWasLiked $event)
{
if ($event->post->user->id != $event->user->id) {
if ($event->post->user && $event->post->user->id != $event->user->id) {
$this->notifications->sync(
new PostLikedBlueprint($event->post, $event->user),
[$event->post->user]

View File

@ -30,7 +30,7 @@ class SendNotificationWhenPostIsUnliked
public function handle(PostWasUnliked $event)
{
if ($event->post->user->id != $event->user->id) {
if ($event->post->user && $event->post->user->id != $event->user->id) {
$this->notifications->sync(
new PostLikedBlueprint($event->post, $event->user),
[]