I have something strange happening which I can't understand and wondered if anyone could help me work out what's going on.
I have 2 tables (assessors, processes) and a pivot (process_assessor). I am trying to update the pivot with an assessor's processes so I have a form which when submitted is passed to this method...
public function updateProcesses( $id )
{
$assessor = $this->model->find( $id );
return $assessor->processes()->sync( $this->request->get( 'process_id' ) );
}
This works fine however when updating a user to have no processes I get an error message...
Argument 1 passed to Illuminate\Database\Eloquent\Relations\BelongsToMany::formatSyncList() must be of the type array, null given, called
However, (and this is the weird bit) I also have a user profile module which uses exactly the same way to 'sync' with the pivot table however when I submit that form with all options for that particular module unchecked then it works, the user is detached from them in the pivot.
What am I doing wrong? Any ideas?