Simple repeater and $get

Hi, When using $get on a simple repeater, the state shown is not the simple array of value shown in the doc, but the internal representation of the repeater.
Repeater::make('invitations')
->simple(
TextInput::make('email')
->email()
->required(),
)
Placeholder::make('foo')->content(fn (Get $get) => dump($get('invitations'))
Repeater::make('invitations')
->simple(
TextInput::make('email')
->email()
->required(),
)
Placeholder::make('foo')->content(fn (Get $get) => dump($get('invitations'))
returns
"invitations" => array:2 [
"cc35096d-4cfc-4207-bbc5-05b70db95fee" => array:1 [
"email" => array:1 [
"email" => null
]
]
"e44bad27-018c-4ef2-af1e-2edd2947687b" => array:1 [
"email" => null
]
]
"invitations" => array:2 [
"cc35096d-4cfc-4207-bbc5-05b70db95fee" => array:1 [
"email" => array:1 [
"email" => null
]
]
"e44bad27-018c-4ef2-af1e-2edd2947687b" => array:1 [
"email" => null
]
]
Is this a known behavior? An issue? Thanks.
4 Replies
charlie
charlie2mo ago
Hi @mathieutu, that's the normal behavior if I'm not mistaken (nice to see you finally get into filament ;))
mathieutu
mathieutuOP2mo ago
normal behavior
Yeah, but I find it weird to not have the same value from $get than when stored in DB or passed in as default.
finally get into filament
Not without pain, I'm afraid 😅
charlie
charlie2mo ago
Yeah, $get() doesn't query the DB, it gets the livewire object or something like that... What are you trying to do? Maybe I can help, I had some repeaters in my last project as well By the way, a big major version of Filament is about to come (no date yet), so if you're not in a hurry I'd advise to wait for it...
mathieutu
mathieutuOP2mo ago
No need to query the dB here. But just to have the same result when using $get and getState() on the same form. Good to know, thanks! But my project is well started, so I'll see and update when the new version will come.

Did you find this page helpful?