Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bernardev's avatar

Json column - Date field must cast to 'date' in Eloquent model

I have a laravel nova panel like below. Im trying to use a Date field like below:

 new Panel('Suggestions', [
                Flexible::make('Suggestions')
                    ->addLayout('Suggestions', 'suggestion', [
                        Text::make('Title'),
                        Textarea::make('Message'),
                        Date::make('Date', 'date')
                    ])

                ->button('Add Suggestion'),

        ]),
		

However it shows this error:

{message: "Date field must cast to 'date' in Eloquent model.", exception: "Exception",…}
exception: "Exception"
file: "/var/www/html/vendor/laravel/nova/src/Fields/Date.php"
line: 41
message: "Date field must cast to 'date' in Eloquent model."

I have in the model the casts property like this:

 protected $casts = [
        'date' => 'date'
    ];

Do you know what can be the issue?

0 likes
2 replies
bernardev's avatar

I don't have a date field on the database table relative to the model. I just have a suggestions json field that has a lot of columns including the "date" column, probably that's the issue. Do you know how to solve this issue in this scenario? Thanks

Please or to participate in this conversation.