HasOne Relationship on repeater not using the default data

I have created a one to one relation with default data but the repeater doesn't show this data when a relation doesn't exist. Any help?
2 Replies
Patrick Boivin
Maybe with afterStateHydrated(), example here with a different field : https://github.com/filamentphp/filament/discussions/6813#discussioncomment-6222756
Haggai
HaggaiOP2y ago
@pboivin, Thanks for the direction. The following worked perfectly: ->afterStateHydrated(function ($component, $state, Model $record) { if (! filled($state)) { $component->state([$record->relation->getAttributes()]); } })
Want results from more Discord servers?
Add your server