Commit 3c069ced authored by Jens Segers's avatar Jens Segers

Fixed DateTime error

parent 5c272572
...@@ -35,13 +35,24 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model { ...@@ -35,13 +35,24 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model {
} }
/** /**
* Get a fresh timestamp for the model. * Return a timestamp as DateTime object.
* *
* @return MongoDate * @param mixed $value
* @return DateTime
*/ */
public function freshTimestamp() protected function asDateTime($value)
{ {
return new MongoDate; if ($value instanceof MongoDate)
{
$value = $value->sec;
}
if (is_int($value))
{
$value = "@$value";
}
return new DateTime($value);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment