Permalink
Browse files

allow date array on eloquent objects for quick setting of dates.

  • Loading branch information...
taylorotwell committed Sep 7, 2013
1 parent f5a3211 commit f15b034dc744290a08e0abc776f06ed991426d4e
Showing with 10 additions and 1 deletion.
  1. +10 −1 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);
}
/**

0 comments on commit f15b034

Please sign in to comment.