Skip to content

Commit

Permalink
allow date array on eloquent objects for quick setting of dates.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 7, 2013
1 parent f5a3211 commit f15b034
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Expand Up @@ -118,6 +118,13 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa
*/ */
protected $guarded = array('*'); protected $guarded = array('*');


/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = array();

/** /**
* The relationships that should be touched on save. * The relationships that should be touched on save.
* *
Expand Down Expand Up @@ -2085,7 +2092,9 @@ public function hasSetMutator($key)
*/ */
public function getDates() public function getDates()
{ {
return array(static::CREATED_AT, static::UPDATED_AT, static::DELETED_AT); $defaults = array(static::CREATED_AT, static::UPDATED_AT, static::DELETED_AT);

return array_merge($this->dates, $defaults);
} }


/** /**
Expand Down

0 comments on commit f15b034

Please sign in to comment.