diff --git a/domains/Contact/ManageContactImportantDates/Services/CreateContactImportantDate.php b/domains/Contact/ManageContactImportantDates/Services/CreateContactImportantDate.php index 93cb65af7b2..efc5470d994 100644 --- a/domains/Contact/ManageContactImportantDates/Services/CreateContactImportantDate.php +++ b/domains/Contact/ManageContactImportantDates/Services/CreateContactImportantDate.php @@ -80,7 +80,7 @@ private function validate(): void $this->validateRules($this->data); // make sure the vault matches - if ($this->valueOrNull($this->data, 'contact_important_date_type_id')) { + if (! is_null($this->valueOrNull($this->data, 'contact_important_date_type_id'))) { ContactImportantDateType::where('vault_id', $this->data['vault_id']) ->findOrFail($this->data['contact_important_date_type_id']); } diff --git a/domains/Contact/ManageContactImportantDates/Web/Controllers/ContactImportantDatesController.php b/domains/Contact/ManageContactImportantDates/Web/Controllers/ContactImportantDatesController.php index 58b1bf253e1..911f35b4c2d 100644 --- a/domains/Contact/ManageContactImportantDates/Web/Controllers/ContactImportantDatesController.php +++ b/domains/Contact/ManageContactImportantDates/Web/Controllers/ContactImportantDatesController.php @@ -55,7 +55,7 @@ public function store(Request $request, int $vaultId, int $contactId) 'author_id' => Auth::user()->id, 'vault_id' => $vaultId, 'contact_id' => $contactId, - 'contact_important_date_type_id' => $request->input('contact_important_date_type_id'), + 'contact_important_date_type_id' => $request->input('contact_important_date_type_id') == 0 ? null : $request->input('contact_important_date_type_id'), 'label' => $request->input('label'), 'day' => $day, 'month' => $month,