title: Eloquent ORM: Define allowed model attributes
body: <p>In laravel's <a href="https://laravel.com/docs/5.3/eloquent" rel="noreferrer">eloquent</a> ORM, is there a way to define a model's allowed attributes?</p>
  
  <p>By default I can put any attributes into the model's constructor - but then I only get notified about the erroneous attribute names when I actually try to save the model to database.</p>
  
  <p>Example code:</p>
  
  <pre><code>// this works although there is a typo in "lastname"
  $user = new \App\User(['firstname' =&gt; 'foo', 'lastnam' =&gt; 'bar']);
  
  // this errors out with an SQL error
  $user-&gt;save();
  </code></pre>
  
  <hr>
  
  <p>So, is there a way to let Laravel automatically check if there are invalid keys in the request's input data?</p>