Closed
Description
- Laravel-mongodb Version: 5.2.2
- PHP Version: 8.2.28
- Database Driver & Version:
Description:
Steps to reproduce
- Add
Date::use(CarbonImmutable::class);
in yourAppServiceProvider
's boot method.
Expected behaviour
There should not be any exception
Actual behaviour
An exception occurs with the message:
MongoDB\\Laravel\\Eloquent\\Model::asDateTime(): Return value must be of type Carbon\\Carbon, Carbon\\CarbonImmutable returned
This can be solved if we change the return type of asDateTime
to CarbonInterface
or DateTimeInterface
.
Logs:
{
"message": "MongoDB\\Laravel\\Eloquent\\Model::asDateTime(): Return value must be of type Carbon\\Carbon, Carbon\\CarbonImmutable returned",
"exception": "TypeError",
"file": "/var/www/html/sg-ui-backend/vendor/mongodb/laravel-mongodb/src/Eloquent/DocumentModel.php",
"line": 136
}