Replies: 3 comments 4 replies
-
I am experiencing something similar, although in my case it is the other way around (trying to access something from the 'main' form inside the Anyway, maybe this will help you: if you do a |
Beta Was this translation helpful? Give feedback.
-
Hello, @nexxai: did you find a way to do what you expected? I am trying to do the same: retrieve the state of a |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, i also bump into this, after finding this discussion i was able to discover a way to get the correct value debuging using the $get('*'), so to get the value in your example just add the suffix "_type" assuming that you are using in the table entrant_type/entrant_id ->visible(function (Get $get) {
return $get('entrant_type') instanceof AnonymousUser;
return $get('entrant_type') === Relation::getMorphAlias(AnonymousUser::class); // If you are using alias
}) \Illuminate\Database\Eloquent\Relations\MorphTo::getMorphType:74
$typeColumn = $relationship->getMorphType();
\Illuminate\Database\Eloquent\Relations\MorphTo::getMorphType:83
$typeSelect = Select::make($typeColumn) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Package
Form builder
Package Version
v3.2.110
How can we help you?
I've got a form where I want an element to only appear when the value of a
MorphToSelect::
field above it matches a certain criteria.I only want the
referral_source_id
field to appear when the selectedentrant
is anAnonymousUser
.I've tried every permutation of this:
But no matter what I do,
$get('entrant')
is alwaysnull
it obviously never shows.Am I missing something or is what I'm trying to do impossible because it's a Morph model instead of a regular relationship?
Beta Was this translation helpful? Give feedback.
All reactions