title: Advantages of guarded foreign keys on eloquent models
body: <p>I have a table called users. This table has a foreign key called project_id in another table called projects. Users on my page will see a dropdown that contains all projects and will be able to select one of them. I will then use the primary key of the selected project to be a foreign key to the newly created user.</p>
  
  <p>Now in laravel's eloquent model, I have read that foreign keys should always be guarded (can't be mass assignable) for security. I don't really understand why that is. Suppose I validated that the project_id exists in the projects table, shouldn't I be confident that the value is valid and can now be mass assigned to the User model? Is there any other reason I'm missing why people say foreign keys should always be guarded?</p>