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?
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/key, probably that's the issue. Do you know how to solve this issue in this scenario? Thanks