Get parent record in Relationship Manager

Hi, I am building the create/edit form in a relationship manager and I need to create a Select dropdown list of rows that are related to the parent row. How do I access the parent row in the form section of a relationship manager?
Solution:
i don't know where do you want to use that, but since you've mentioned 'Select', probably in the
->options(fn ($livewire) => YourModel::where('parent_id', $livewire->ownerRecord->id)->pluck(...))
->options(fn ($livewire) => YourModel::where('parent_id', $livewire->ownerRecord->id)->pluck(...))
...
Jump to solution
6 Replies
Saade
Saade2y ago
fn ($livewire) => $livewire->ownerRecord
fn ($livewire) => $livewire->ownerRecord
rich06
rich06OP2y ago
Thanks - so where would I attach that closure function?
Solution
Saade
Saade2y ago
i don't know where do you want to use that, but since you've mentioned 'Select', probably in the
->options(fn ($livewire) => YourModel::where('parent_id', $livewire->ownerRecord->id)->pluck(...))
->options(fn ($livewire) => YourModel::where('parent_id', $livewire->ownerRecord->id)->pluck(...))
Saade
Saade2y ago
or getOptionsUsing or getSearchResultsUsing you get it
rich06
rich06OP2y ago
Thanks again - I had worked it out. I realised my question was pretty dumb after I sent it so sorry to waste your time!
Saade
Saade2y ago
No worries mate, we're here to help

Did you find this page helpful?