title: Setting dates as nullable in laravel
body: <p>I am having a hard time understanding the inner workings of date fields in laravel. I have a custom date field named <code>called_at</code> and I set it as nullable in the schema. Since it's a date field, <a href="https://laravel.com/docs/5.6/eloquent-mutators#date-mutators" rel="noreferrer">I would naturally want it to be a Carbon instance</a>, so in the model I pushed this attribute to the <code>$dates</code> array.</p>
  
  <pre><code>protected $dates = ['called_at'];
  </code></pre>
  
  <p>In order to be able to set it from the controller, via the <code>request('called_at')</code> input, I would have to set a mutator in the model. So I set one like this:</p>
  
  <pre><code>public function setCalledAtAttribute($date){
      $this-&gt;attributes['called_at'] = Carbon::parse($date);
  }
  </code></pre>
  
  <p>But the problem is, even if the user does not provide a date in the input field, the <code>called_at</code> attribute is set to the current timestamp! But I expected it to be NULL.</p>
  
  <p>To get rid of it, I commented out the <code>setCalledAtAttribute</code> mutator. But now it won't even take the input:</p>
  
  <blockquote>
    <p>InvalidArgumentException Data missing</p>
  </blockquote>
  
  <p>Bottom line, how can I set my date field nullable in such a way that when a user leaves the input field blank, the <code>called_at</code> field wont be set to current timestamp?</p>