armincms / json

A laravel nova field
MIT License
26 stars 2 forks source link

Date/datetime is not supported #1

Closed kohutovic closed 4 years ago

kohutovic commented 4 years ago

If I use date/datetime Nova returns: "Date field must cast to 'date' in Eloquent model. Is there a way how to handle those field types.

zareismail commented 4 years ago

Hey; thanks for reporting.

This package doesn't change the default behavior of fields. so; you can use the resolvingUsing method for those fields like below:

->resolveUsing(function($value) {
       return $value ?? new \Illuminate\Support\Carbon($value);
 })