public function setAttachments(array $attachments) { $this->clearAttachments(); foreach ($attachments as $attachment) { $this->attach($attachment); } return $this; }