i am trying to update data and my json has multiple objects currently my json is:
          "privileges":{
          "facilities": [
      {
        "facility_id": 1,
        "is_facility_supervisor": 0,
        "speciality_id": 2,
        "id": 1
      }
    ]
}
my controller:
        $body = $request->all();
         $userPrev = $body['privileges'];
    $facilities = $userPrev['facilities'];
          $fac = $this->userFacility->where('user_id', $facilities['id'])->value('id');
        if($fac) {
            $userFac = $this->userFacility->find($fac);
            $userFac->fill($facilities)->save();
        } else {
            $userFac = $this->userFacility->create($request->only($this->userFacility->getModel()->fillable));
        }
but i find "Undefined index: id" error i dont where i am doing wrong your help will be highly appreciated!
 
    