fix: check for null values on claimed & filled

This commit is contained in:
AnabolicsAnonymous
2025-08-25 10:24:54 -05:00
parent 436d8e7007
commit 8832a12cd8

View File

@@ -50,8 +50,8 @@ class TorrentRequestResource extends JsonResource
'bounty' => $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, $this->claim?->anon ? 'anonymous' : ($this->claim?->user?->username ?? null)),
'filled_by' => $this->when($this->filled_by, $this->filled_anon ? 'anonymous' : ($this->filler?->username ?? null)),
'claimed_by' => $this->when($this->claim !== null, $this->claim?->anon ? 'anonymous' : ($this->claim?->user?->username ?? null)),
'filled_by' => $this->when($this->filled_by !== null, $this->filled_anon ? 'anonymous' : ($this->filler?->username ?? null)),
'created' => $this->created_at->toIso8601String(),
'updated_at' => $this->updated_at->toIso8601String(),
];