Form with deeper relationship

Hi everyone, Is it possible to have a form relationship using a deeper model relationship, such as: Applicant -> User -> PersonalInformation I want to create a form for PersonalInformation model in ApplicantResource. I've tried something like:
Grid::make()
->relationship('user.personalInformation')
->schema([
TextInput::make('phone_number')
])
Grid::make()
->relationship('user.personalInformation')
->schema([
TextInput::make('phone_number')
])
It doesn't work. Thank you!
3 Replies
awcodes
awcodes7mo ago
Dot syntax doesn’t work with relationship() but it allows for defining the options and their labels. The way tables work and the way forms work is different.
Silverhand
SilverhandOP7mo ago
Okay, @awcodes thanks for your reply. What would be the ideal way to accomplish what I'm trying to do? Any suggestion?
awcodes
awcodes7mo ago
You have to think about the way the state maps to the relationship. In your use case the relationship is user then you have another relationship to personal information. So you might need a secondary group where you can define the nested relationship.
Want results from more Discord servers?
Add your server