lockForUpdate()->findOrFail($commit->id); if ($commit->trashed()) { return $commit; } Notification::query()->where('commit_id', $commit->id)->delete(); Notification::query()->where('type', NotificationType::Replied)->whereIn('commit_id', $commit->replies()->select('id'))->delete(); Notification::query()->where('type', NotificationType::Quoted)->whereIn('commit_id', $commit->quotes()->select('id'))->delete(); $commit->delete(); Cache::forget(resolve(CommitTranslations::class)->key($commit)); $this->updateCommitHotScores->handle([$commit->id]); dispatch(new EraseDeletedCommit($commit)) ->delay(now()->addSeconds(Commit::RESTORABLE_SECONDS)) ->afterCommit(); return $commit->refresh(); }, attempts: 3); } }