LetterStatus::class, 'submitted_at' => 'datetime', 'completed_at' => 'datetime', ]; } public function registerMediaCollections(): void { $this->addMediaCollection('letter_result')->singleFile(); } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function processor(): BelongsTo { return $this->belongsTo(User::class, 'processed_by'); } protected function resultUrl(): Attribute { return Attribute::make( get: fn () => $this->getFirstMediaUrl('letter_result') ?: null, ); } protected function resultName(): Attribute { return Attribute::make( get: fn () => $this->getFirstMedia('letter_result')?->file_name, ); } }