title: internal messaging system laravel database design
body: <p>I am building an internal messaging system for a forum that I have built with Laravel 5.3. Basically, I want to have messaging functionality, similar to Linkedin- <code>User</code> can send an email to another <code>User</code> and vice versa. There is going to be a single thread for a given conversation, which will take place between two users. I have been looking through some questions on StackOverflow, but haven't quite found what I am after- in terms of database design.</p>
  
  <p>Here is what I was thinking:</p>
  
  <p><code>messages</code>:</p>
  
  <ul>
  <li>id PK   </li>
  <li>sender_id FK to <code>users</code>.<code>user_id</code></li>
  <li>content</li>
  </ul>
  
  <p><code>message_recipients</code>:</p>
  
  <ul>
  <li>id PK</li>
  <li>message_id FK to <code>messages</code>.<code>id</code></li>
  <li>recipient_id FK to <code>users</code>.<code>id</code></li>
  </ul>
  
  <p>However, I am not 100% sure on the types of relationships there should be between the <code>users</code>, <code>messages</code> and <code>message_recipients</code>. Users would have many messages. Messages would belong to a User. But, how would I factor in the <code>message_recipients</code> table?</p>
  
  <p>Feel free to suggest a different design :)</p>