The value column is nullable and the \OptimistDigital\NovaSettings\Models\Settings model has an accessor defined for value which will return null, but in the controller it's defaulting to an empty string. For what it's worth, nova uses data_get($resource, str_replace('->', '.', $attribute)) which will default to null.
The problem with an empty string is nova is expecting null in their DateTime field and throwing an exception when it's passed an empty string. Here's their code for reference:
if (! is_null($value)) {
if ($value instanceof DateTimeInterface) {
return $value->format($this->dateFormat);
}
throw new Exception("DateTime field must cast to 'datetime' in Eloquent model.");
}
I think this is only an issue for fields that have nested fields (aka $field->meta['fields']) since findOrNew is used for regular fields. I'll submit a PR in a minute
https://github.com/optimistdigital/nova-settings/blob/master/src/Http/Controllers/SettingsController.php#L36
The value column is nullable and the
\OptimistDigital\NovaSettings\Models\Settings
model has an accessor defined for value which will return null, but in the controller it's defaulting to an empty string. For what it's worth, nova usesdata_get($resource, str_replace('->', '.', $attribute))
which will default to null.The problem with an empty string is nova is expecting null in their DateTime field and throwing an exception when it's passed an empty string. Here's their code for reference:
I think this is only an issue for fields that have nested fields (aka
$field->meta['fields']
) sincefindOrNew
is used for regular fields. I'll submit a PR in a minute