F
Filament5mo ago
Kyle

Get ID of parent model when making a child model using Relationship Manager via the modal

For example, when I am using a relationship manager to show the students inside a class. And the form editor for the class is currently showing the class edit form, and the students are shown in a table at the bottom of the page. There is a button in the table to create a new student, which will show a modal for creating the student. Fortunately, the class_id is automatically set when saving the student model, but I need the class_id for a different purpose. How do I get the parent class model (or at least its id property) so that I can use it in the dependency-injected functions? Thank you very much in advance.
2 Replies
gladjanus43
gladjanus435mo ago
$livewire->ownerRecord gives the parent record from the relationmanager
Kyle
KyleOP5mo ago
Thank you very much! I'll try that.
Want results from more Discord servers?
Add your server