Commit 6d9ca96f authored by Jens Segers's avatar Jens Segers

Fixed error after Laravel update

parent 42b6cb95
...@@ -26,12 +26,24 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model { ...@@ -26,12 +26,24 @@ abstract class Model extends \Illuminate\Database\Eloquent\Model {
/** /**
* Convert a DateTime to a storable string. * Convert a DateTime to a storable string.
* *
* @param DateTime $value * @param DateTime|int $value
* @return MongoDate * @return string
*/ */
protected function fromDateTime(DateTime $value) protected function fromDateTime($value)
{ {
return new MongoDate($value->getTimestamp()); // Convert DateTime to MongoDate
if ($value instanceof DateTime)
{
$value = new MongoDate($value->getTimestamp());
}
// Convert timestamp to MongoDate
elseif (is_numeric($value))
{
$value = new MongoDate($value);
}
return $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