Array to String
I'm trying to use a pivot table and I get this error here's the flare: https://flareapp.io/share/lm2KAqOP
and also attached are my models and form



4 Replies
Please read the #✅┊rules and avoid code screenshots
As for the error - there is one of the fields that returns an array for whatever reason. I would suspect the selects for department, so try to debug them to see what they return
my bad sorry about that.
how would I check? that I'm new to this ,
this is what's in the request body:
Oh, okay. This happens on update (missed that!)
The reason this happens is that it attempts to set the employee_department as array. Imagine this code:
$employee->departments()->attach(['dept_id' => 1, 'supervisor' => true])
To fix this, you need to look at https://filamentphp.com/docs/3.x/panels/resources/relation-managers#creating-with-pivot-attributes and most likely change how the form is defined. Can't help there exactly as I didn't do much work with many to many and pivots 😦Please ensure that any pivot attributes are listed in the withPivot() method of the relationship and inverse relationship.So does that mean I have to list all pivot table columns using the withPivot() method? Also that part of the documentation is very uninformative 😥