Problem with "belongsToMany" not working

Hi, maybe someone knows the solution. When adding new entities using the admin panel, there is an error - the panel stops loading the table or form view, and the console returns errors as in the screenshot. I discovered that the cause is the relation “belongsToMany, when I replace it with “belongsTo” everything works.

Here is a code snippet. I am trying to add a new unit, but the events do not work either. Interestingly, the groups themselves work fine, I can add several members.

And it's not a problem with policies either, I've already tried removing and changing them.
obraz.png
obraz.png
Was this page helpful?