update: add null check for bounties

This commit is contained in:
AnabolicsAnonymous
2025-08-25 10:32:40 -05:00
parent 8832a12cd8
commit 2775ceee18

View File

@@ -47,7 +47,7 @@ class TorrentRequestResource extends JsonResource
'igdb' => $this->igdb,
'season_number' => $this->when($this->season_number !== null, $this->season_number),
'episode_number' => $this->when($this->episode_number !== null, $this->episode_number),
'bounty' => $this->bounties?->sum('seedbonus') ?? 0,
'bounty' => $this->when($this->bounties !== null, $this->bounties?->sum('seedbonus') ?? 0),
'status' => $this->filled_by ? ($this->approved_by ? 'filled' : 'pending') : ($this->claim ? 'claimed' : 'unfilled'),
'claimed' => (bool) $this->claim,
'claimed_by' => $this->when($this->claim !== null, $this->claim?->anon ? 'anonymous' : ($this->claim?->user?->username ?? null)),