Skip to content

Commit

Permalink
修正小问题
Browse files Browse the repository at this point in the history
  • Loading branch information
oiuv committed Dec 7, 2020
1 parent 3a24c2e commit 312eb53
Show file tree
Hide file tree
Showing 2 changed files with 2,263 additions and 2,293 deletions.
6 changes: 4 additions & 2 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ public function boot()
Event::listen(RelationToggled::class, function ($event) {
if (!empty($event->attached)) {
foreach ($event->attached as $threadId) {
Thread::find($threadId)->user->userEnergyUpdate($event->getRelationType());
if ($thread = Thread::find($threadId))
$thread->user->userEnergyUpdate($event->getRelationType());
}
}

if (!empty($event->detached)) {
foreach ($event->detached as $threadId) {
Thread::find($threadId)->user->userEnergyUpdate($event->getRelationType().'-cancel');
if ($thread = Thread::find($threadId))
$thread->user->userEnergyUpdate($event->getRelationType().'-cancel');
}
}
});
Expand Down
Loading

0 comments on commit 312eb53

Please sign in to comment.