Benjacho / belongs-to-many-field-nova

Belongs To Many field Laravel nova to represent many to many relationship in field.
MIT License
157 stars 81 forks source link

Error when updating #19

Closed noahlocke closed 4 years ago

noahlocke commented 5 years ago
BelongsToManyField::make('Services', 'services', 'App\Nova\Service')
  ->rules('min:1','max:1','required')
  ->options(\App\Service::whereHas('counties', function ($q) 
    {
      $q->where('county_id', $this->county_id);
    }
)->get())

When I create a resource, the field correctly creates the relationships, however when I attempt to edit and update a resource it appears that Nova is trying to set a value on a column rather than sync the attached relationships:

Error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column services in 'field list' (SQL: update notes set has_notes = 0, services = ?, notes.updated_at = 2019-10-22 21:40:12 where id = 557)"

Benjacho commented 5 years ago

I will see it

noahlocke commented 5 years ago

@Benjacho were you able to recreate?

Benjacho commented 5 years ago

what version are ou using?

noahlocke commented 5 years ago

@Benjacho v1.2.1

noahlocke commented 4 years ago

@Benjacho This turned out to be an issue with another package! Closing this issue :)