diff --git a/app/Models/Document/Document.php b/app/Models/Document/Document.php index e30eaecd6..8de073dac 100644 --- a/app/Models/Document/Document.php +++ b/app/Models/Document/Document.php @@ -276,9 +276,11 @@ class Document extends Model */ public function getAttachmentAttribute($value = null) { - if (!empty($value) && !$this->hasMedia('attachment')) { + $has_attachment = $this->hasMedia('attachment'); + + if (! empty($value) && ! $has_attachment) { return $value; - } elseif (!$this->hasMedia('attachment')) { + } elseif (! $has_attachment) { return false; }