Issue with Pivot relation on Repeater
Hello i've been following the steps in the documentation: https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-an-eloquent-relationship
In order to save a pivot relationship in a repeater field. However as soon as i add the "->relationship()" chain to the repeater field i get the following error: https://flareapp.io/share/v5pKjbM7
Repeater field code:
Let me know if you need any more info and thanks in advance!
Flare
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 769 - The error occurred at http://localhost/requests/create
Solution:Jump to solution
oh the error on the Select component not the repeater
do you have the relation
travellers
in TravellerRequest
...6 Replies
how your model looks?
the relationship must named requestTravellers
It is indeed:
good, also I dont think
simple
support relation, it's only for flat arrayOk, swapped it to a "normal" repeater:
and looks like the same error is thrown: https://flareapp.io/share/OmVwxJ4P
Flare
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 769 - The error occurred at http://localhost/requests/create
Solution
oh the error on the Select component not the repeater
do you have the relation
travellers
in TravellerRequest
AHHH, always a bloody typo xD. I put 'travellers' on the select component and 'traveller' on the pivot model... Thank you, problem solved xD