F
Filament2mo ago
Emaz

Multiple levels of relationships and chatGPT

Rooms are rarely changed (it's just names such as Kitchen, Bedroom 1 etc). A property has many rooms and rooms can be used by other properties, so many to many, right? And checklists are used by many rooms (these are cleaning checklists per each room) so again, many to many? I need a repeater to attach rooms and checklists to a property, as well as multiple photos. So a user would set up a property and select rooms and checklists. I have a pivot table property_room with property_id, room_id etc. I thought this code would do it but all I get is Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in /var/www/html/vendor/filament/forms/src/Components/Select.php on line 773 Don't hate me, I understand the perils of chatGPT and that it doesn't know v3 but it insists that the relationships are too complex for Filament and I need to overrride the save method. That does NOT feel right. Would appreciate guidance here - can't find my use in the docs. Would love to get an example that has similar levels of many to many.
No description
Solution:
Figured it out. In case any else runs into this, this completely solved my issue. Now I have a new one I will post lol https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-a-belongstomany-eloquent-relationship...
Jump to solution
1 Reply
Solution
Emaz
Emaz2mo ago
Figured it out. In case any else runs into this, this completely solved my issue. Now I have a new one I will post lol https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-a-belongstomany-eloquent-relationship