title: How to customize date mutators in Laravel?
body: <p>I've created a few datetime fields in my database, and as is described in Laravel documentation, I can "customize which fields are automatically mutated". However there's no example showing how it can be done, nor is there any search result. What should I do to make certain fields auto mutate?</p>
  
  <p>For example, I created a table called "people" in migration, one of the fields is defined as this:</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>class CreatePeopleTable extends Migration {
    public function up(){
      Schema::create("bookings",function($table){
        ...
        $table-&gt;dateTime("birthday");
        ...
      }
    }
  }
  </code></pre>
  
  <p>And I defined a model for "people" in models:</p>
  
  <pre class="lang-php prettyprint-override"><code>class People extends Eloquent{
    //nothing here
  }
  </code></pre>
  
  <p>If I refer to the birthday of a People instance, it'll be string, instead of DateTime</p>
  
  <pre class="lang-php prettyprint-override"><code>$one=People::find(1);
  var_dump($one-&gt;birthday);
  //String
  </code></pre>
  
  <p>The date mutator should be able to convert it directly to Carbon object, but the documentation doesn't say much about how it should be implemented. </p>