<?php
 namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; class TicketOriginalEmail extends Model { protected $fillable = [ 'ticket_id', 'reply_id', 'file_path', 'uuid', 'from_email', 'subject', 'file_size', 'scan_status', 'date_folder', 'pruned', 'pruned_at', ]; protected $casts = [ 'file_size' => 'integer', 'pruned' => 'boolean', 'pruned_at' => 'datetime', ]; public function ticket(): BelongsTo { return $this->belongsTo(Ticket::class); } public function reply(): BelongsTo { return $this->belongsTo(TicketReply::class, 'reply_id'); } public function isInfected(): bool { return $this->scan_status === 'infected'; } public function isDownloadable(): bool { return ! $this->pruned && ! $this->isInfected(); } } 