F
Filamentβ€’4mo ago
meebo

Update relationship on a conditional field

Hello there, I have an employment model/resource that belongsTo a user, employment hasOne Accountant, the accountant is conditional if the employment is SelfEmployed. If the condition is met, I can see the accountant form which has its own model. My question is how do I create/hydrate the accountant form data. Is the best approach to create a relationship using the relationship manager or is there a way to inject the accountant data, as currently the accountant data is trying to be saved to the employments model not the accountants model. Thanks in advance, apologies if this is answered somewhere else.
1 Reply
meebo
meeboβ€’4mo ago
I think I have solved it by adding a relationship to the section, will test and update accordingly.
Section::make('Accountant Information')
->relationship('accountant')
Section::make('Accountant Information')
->relationship('accountant')
This fixed it for anyone else looking for this information πŸ™‚