Replies: 1 comment
-
Hmm, I get your point but I don't think this is the way to go. The settings package is based upon strong types so in this case I would just type CarbonImmutable. When somebody changes the type of the Date facade the type would automatically change too in the settings. Atm there aren't that many differences between the serialization format of Carbon and CarbonImmutable but changing between DateTime and CarbonImmutable would be disastrous. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋
To store the date-time in my settings, I use type
CarbonInterface
as a universal option betweenCarbon
andCarbonImmutable
. In my application, I have configuredDate
facade to useCarbonImmutable
.The only problem is that
\Spatie\LaravelSettings\SettingsCasts\DateTimeInterfaceCast
does not understand this type of field and gives an error when reading:I suggest adding type support to
CarbonInterface
by implementing date instantiation throughDate
facade so that the type of object being created depends on the facadeuse()
setting.Now I have to extend the cast class to get what I need:
Beta Was this translation helpful? Give feedback.
All reactions