outl1ne / nova-settings

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

null values are getting casted #85

Closed JoshMoreno closed 2 years ago

JoshMoreno commented 2 years ago

In my current app, I'm trying to use a nullable DateTime field but since it's getting casted, I'm getting a Carbon instance back (aka now()) which is a problem.

The problem is Settings::getValueAttribute which is casting null values. The default laravel behavior, which this package seems like it's trying to emulate, doesn't do this for a bunch of cast types (see \Illuminate\Database\Eloquent\Concerns\HasAttributes::$primitiveCastTypes and \Illuminate\Database\Eloquent\Concerns\HasAttributes::castAttribute).

I'll submit a PR

Tarpsvo commented 2 years ago

Hi! Thanks for the report and PR. :) I merged all of your fixes and released them in version 3.3.0. Thanks again and good luck!