'datetime', 'include_media' => 'boolean', 'scope' => DataExportScope::class, ]; public function user(): BelongsTo { return $this->belongsTo(User::class); } public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } public function event(): BelongsTo { return $this->belongsTo(Event::class); } public function isReady(): bool { return $this->status === self::STATUS_READY; } public function canRetry(): bool { return in_array($this->status, [self::STATUS_FAILED, self::STATUS_CANCELED], true); } public function canCancel(): bool { return in_array($this->status, [self::STATUS_PENDING, self::STATUS_PROCESSING], true); } public function resetForRetry(): void { $this->update([ 'status' => self::STATUS_PENDING, 'error_message' => null, 'path' => null, 'size_bytes' => null, 'expires_at' => null, ]); } public function markCanceled(?string $reason = null): void { $this->update([ 'status' => self::STATUS_CANCELED, 'error_message' => $reason ?: 'Canceled by superadmin.', 'path' => null, 'size_bytes' => null, 'expires_at' => null, ]); } public function hasExpired(): bool { return $this->expires_at !== null && $this->expires_at->isPast(); } }