diff --git a/app/Jobs/GithubJob.php b/app/Jobs/GithubJob.php index 25b0df3..729373c 100644 --- a/app/Jobs/GithubJob.php +++ b/app/Jobs/GithubJob.php @@ -48,28 +48,12 @@ public function handle(): ?bool if ( $exception->hasResponse() - && $exception->getResponse()->getStatusCode() === Response::HTTP_NOT_FOUND + && in_array($exception->getResponse()->getStatusCode(), [Response::HTTP_NOT_FOUND, Response::HTTP_FORBIDDEN]) ) { - if (property_exists($this, 'user')) { - $this->user->update([ - 'block_reason' => BlockReason::DELETED(), - 'blocked_at' => now(), - ]); - } - - if (property_exists($this, 'repository')) { - $this->repository->update([ - 'block_reason' => BlockReason::DELETED(), - 'blocked_at' => now(), - ]); - } - - if (property_exists($this, 'organization')) { - $this->organization->update([ - 'block_reason' => BlockReason::DELETED(), - 'blocked_at' => now(), - ]); - } + $this->entity()->update([ + 'block_reason' => BlockReason::DELETED(), + 'blocked_at' => now(), + ]); $this->delete(); }