Skip to content

Commit

Permalink
add note on date format.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jul 6, 2015
1 parent 20f01d0 commit 2116f62
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions eloquent-mutators.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ As noted above, when retrieving attributes that are listed in your `$dates` prop

return $user->disabled_at->getTimestamp();

If you need to customize the format of your timestamps, set the `$dateFormat` property on your model. This property determines how date attributes are stored in the database, as well as their format when the model is serialized to an array or JSON:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Flight extends Model
{
/**
* The storage format of the model's date columns.
*
* @var string
*/
protected $dateFormat = 'U';
}

<a name="attribute-casting"></a>
## Attribute Casting

Expand Down

0 comments on commit 2116f62

Please sign in to comment.