title: How to add multiple values to model before save in Laravel?
body: <p>I have a custom fuction to parse incoming emails and their attachements. Of course one email may contain multiple attachement.</p>
  
  <p>I have this code:</p>
  
  <pre><code>public function parseEmail() {
      // read from stdin
      $fd = fopen("php://stdin", "r");
      $rawEmail = "";
      while (!feof($fd)) {
          $rawEmail .= fread($fd, 1024);
      }
      fclose($fd);
      $parser = new Parser();
      $parser-&gt;setText($rawEmail);
  
      $email = new Email;
      $email-&gt;to = $parser-&gt;getHeader('to');
      $email-&gt;from = $parser-&gt;getHeader('from');
      $email-&gt;subject = $parser-&gt;getHeader('subject');
      $email-&gt;body_text = $parser-&gt;getMessageBody('text');
  
      $attachments = $parser-&gt;getAttachments();
      $filesystem = new Filesystem;
      foreach ($attachments as $attachment) {
          $filesystem-&gt;put(public_path() . '/uploads/' . $attachment-&gt;getFilename(), $attachment-&gt;getContent());
          $email-&gt;attachement()-&gt;name = $attachment-&gt;getFilename();
      }
      $email-&gt;save();
  
  }
  </code></pre>
  
  <p>Now this code can store only one attachement. But how can I update to store multiple attachements in model?</p>