You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The castAttribute method is overloaded in the base Model class. Unlike in the Core Laravel hasAttributes trait, it is missing handling for null values. See this code snippet from Laravel:
if (is_null($value) && in_array($castType, static::$primitiveCastTypes)) {
return$value;
}
Steps to reproduce
class MyModel extends \MongoDB\Laravel\Eloquent\Model {
protected$casts = [
'my_date' => 'immutable_datetime',
];
}
$model = newMyModel();
$model->my_date; // Should be null, instead is current time.
Expected behaviour
null should be returned.
Actual behaviour
The current time is returned.
The text was updated successfully, but these errors were encountered:
Description:
The
castAttribute
method is overloaded in the baseModel
class. Unlike in the Core LaravelhasAttributes
trait, it is missing handling fornull
values. See this code snippet from Laravel:Steps to reproduce
Expected behaviour
null
should be returned.Actual behaviour
The current time is returned.
The text was updated successfully, but these errors were encountered: