Open
Description
- Laravel-mongodb Version: 5.1
- PHP Version: 8.2
- Laravel Version 11
- Database Driver & Version:
Description:
How to apply for casting when there is embedded fields
Steps to reproduce
- Prepare Create Query
User::create([
'reg_date' => (new Carbon())->format('Y-m-d'),
'input_params' => [
'start_date' => (new Carbon())->format('Y-m-d')
],
]);
- User
namespace App\Models\MongoDb\IpayApp;
use App\Casts\ObjectIdCasts;
use MongoDB\Laravel\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class User extends Model
{
use HasFactory;
protected $connection = 'ipay_app';
protected $table = 'user';
protected $guarded = [];
protected $casts = [
'reg_date' => 'datetime',
'start_date' => 'datetime',
];
}
- reg date is casting properly, while on start casting not work
Expected behaviour
Both Should Cast Accordingly, i have missing something, let me know
Actual behaviour
reg date is casting properly, while on start casting not work
Edited to add code blocks.
Metadata
Metadata
Assignees
Labels
No labels