MorphTo::defaultResource() doesn't select default resource class #5953
Unanswered
wimski
asked this question in
Ideas & Feature Requests
Replies: 3 comments 4 replies
-
@crynobone How is this not a bug, but an 'idea'/'feature request'?
|
Beta Was this translation helpful? Give feedback.
0 replies
-
You request to change the current structure from using defaultResource +
default to only use defaultResource. How is that a bug?
…On Wed, 11 Oct 2023, 2:45 pm Wim Reckman, ***@***.***> wrote:
@crynobone <https://github.com/crynobone> How is this not a bug, but an
'idea'/'feature request'?
Laravel\Nova\Fields\MorphTo
The *default* related *class* value for the field.
Set the *default* relation *resource class* to be selected.
Resolve the *default resource class* for the field.
—
Reply to this email directly, view it on GitHub
<#5953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABKHJVZIX4JCFGEJBWGLDTX6Y6BLAVCNFSM6AAAAAA53OZBFWVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TENBZGA2DE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
From the original PR as reference. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
If I have a resource with a
MorphTo
field on which I call->defaultResource(SomeRelatedResource::class)
. I expect - based on theMorphTo
code below - that thetype
sub field is pre-filled with a default value of the given class.MorphTo field class extract
The value
defaultResource
is correctly passed to the front-end, but it seems it's not used properly. This is probably due to the following:Judging from that last boolean statement, the default resource is only used when there is also a value present. In that case it can never be used as an actual 'default' resource.
Beta Was this translation helpful? Give feedback.
All reactions