-
-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlexibleCast returning a string #311
Comments
Hi @dinandmentink, did you try using JSON casting just to see if all casts are not working or just the FlexibleCast ? Did you |
Thanks for the response. Yes, json casting works as I would expect:
Also, yes confirm I am using
|
Inside the if(app()->getProvider(NovaServiceProvider::class) && !app()->runningInConsole() && !app()->environment('testing')) {
return $value;
} In other words, if you're testing inside Nova itself it won't return the casted value (because the field will take care of it by itself). Is that your case ? |
Ah, yes, thanks, this is the case. This helps a lot, thanks. I ran into this issue because I first tried "what kind of return do I get in Edit: Maybe it would be a good idea to add this to the documentation. Is there a github repo for the documentation that I can write a pr against? |
I have the same issue. How to solve? |
@toonvandenbos I'm running into issues with casting as well due to the raw value being used in all contexts. I'm in the situation where I have Nova installed in my application which is also exposing an API. This means the Am I doing something wrong or is this by design? |
I think I may be missing something obvious, but can't figure it out.
I have an
Association
model, to which I have added a CTA layout:In my
Association
model I use theFlexibleCast
:Now, after saving some cta's the database holds this value in a json column, everything working as I would expect:
However, the cast doesn't seem to work. Because
Association::find(2)->ctas
returns to me the followingString
(!):It doesn't seem to be actually casting
ctas
to a collection of objects. Am I missing something?json_decode
, or using `"json" as cast works as I would expect.The text was updated successfully, but these errors were encountered: