CreateUsingOption() not getting relation in $data
Hello everyone, I am stuck here. I have in a TableRepeater in which I have a Select with a createOptionForm and a createOptionUsing. So it kind of works... I mean, createOptionForm creates the form, I can fill it up normally and when I save it creates the new record. Good BUT, in this record I want to save, I have a relationship (in a Section) and this relation is not saved at all. Neither I get the relation in $data that I pass to createOptionUsing($data).
So in this code if I in createOptionUsing I get something like this :
array:4 [
"name" => "aaaaaaa"
"color" => "#a15353"
"description" => null
"context" => "family"
]
But this is only the half of my form, I was expecting something like
array:4 [
"name" => "aaaaaaa"
"color" => "#a15353"
"description" => null
"context" => "family"
"reverse" => [
"name" => "blablabla"
...
]
]
Does someone can see any reason why I get half of my $data ?
So in this code if I in createOptionUsing I get something like this :
array:4 [
"name" => "aaaaaaa"
"color" => "#a15353"
"description" => null
"context" => "family"
]
But this is only the half of my form, I was expecting something like
array:4 [
"name" => "aaaaaaa"
"color" => "#a15353"
"description" => null
"context" => "family"
"reverse" => [
"name" => "blablabla"
...
]
]
Does someone can see any reason why I get half of my $data ?
Solution
I think you can use
->dehydrated() to get the values instead of saving them directly.