From f15b034dc744290a08e0abc776f06ed991426d4e Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 6 Sep 2013 23:31:12 -0500 Subject: [PATCH] allow date array on eloquent objects for quick setting of dates. --- src/Illuminate/Database/Eloquent/Model.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index 7507159a6def..d087203329ef 100755 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -118,6 +118,13 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa */ protected $guarded = array('*'); + /** + * The attributes that should be mutated to dates. + * + * @var array + */ + protected $dates = array(); + /** * The relationships that should be touched on save. * @@ -2085,7 +2092,9 @@ public function hasSetMutator($key) */ 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); } /**