outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
274 stars 96 forks source link

Error when Date or DateTime field is used. #13

Closed keroth- closed 4 years ago

keroth- commented 4 years ago

Hello!

Thank you for your work.

When I use a Date field or a DateTime field, an error occured:

Date field must cast to 'date' in Eloquent model.

Even if I use the second parameter in your addSettingsFields function.

\OptimistDigital\NovaSettings\NovaSettings::addSettingsFields([
    Date::make('Some date to configure', 'sample_date'),
], [
     'sample_date' => 'date',
]);

Same problem with DateTime field:

\OptimistDigital\NovaSettings\NovaSettings::addSettingsFields([
    DateTime::make('Some datetime to configure', 'sample_datetime'),
], [
     'sample_datetime' => 'datetime',
]);

Thank you for your help. Regards,

Brice

Tarpsvo commented 4 years ago

Sorry about the delay! I fixed Date and DateTime fields and published the fix in version 2.5.0. Good luck!

cgarofalo commented 4 years ago

@Tarpsvo Sorry, I have upgraded to 2.5.0 and I'm still getting the error. It's a bit better than it was before, as the dates actually save to the database this time, still getting the Date field must cast to 'date' in Eloquent model. after save.

Tarpsvo commented 4 years ago

Did you add the cast to 'date'?

cgarofalo commented 4 years ago

@Tarpsvo Yes, it worked now. Sorry for the false alarm.