'required|integer|is_not_unique[vendors.id]', 'contact_type' => 'required|in_list[PRIMARY,SECONDARY,BILLING,TECHNICAL]', 'name' => 'required|max_length[100]', 'position' => 'permit_empty|max_length[100]', 'phone' => 'permit_empty|max_length[20]', 'email' => 'permit_empty|max_length[255]|valid_email', 'is_primary' => 'permit_empty|in_list[0,1]' ]; protected $validationMessages = [ 'vendor_id' => [ 'required' => '벤더사 id는 필수입니다.', 'is_not_unique' => '존재하지 않는 벤더사입니다.' ], 'name' => [ 'required' => '담당자명은 필수입니다.' ], 'email' => [ 'valid_email' => '유효하지 않은 이메일 형식입니다.' ] ]; // 기본 담당자로 설정 public function setPrimaryContact($vendorId, $contactId) { $this->db->transStart(); // 기존 기본 담당자 해제 $this->where('vendor_id', $vendorId) ->set('is_primary', 0) ->update(); // 새로운 기본 담당자 설정 $this->update($contactId, ['is_primary' => 1]); $this->db->transComplete(); return $this->db->transStatus(); } }