handle invalid email address

This commit is contained in:
Denis Duliçi
2023-04-24 11:02:45 +03:00
parent d1cd9a5cd4
commit c15d9349b0
11 changed files with 286 additions and 0 deletions

View File

@ -18,6 +18,13 @@ trait Contacts
return in_array($type, $this->getVendorTypes());
}
public function isEmployee()
{
$type = $this->type ?? $this->contact->type ?? $this->model->type ?? 'employee';
return in_array($type, $this->getEmployeeTypes());
}
public function getCustomerTypes($return = 'array')
{
return $this->getContactTypes('customer', $return);
@ -28,6 +35,11 @@ trait Contacts
return $this->getContactTypes('vendor', $return);
}
public function getEmployeeTypes($return = 'array')
{
return $this->getContactTypes('employee', $return);
}
public function getContactTypes($index, $return = 'array')
{
$types = (string) setting('contact.type.' . $index);
@ -45,6 +57,11 @@ trait Contacts
$this->addContactType($new_type, 'vendor');
}
public function addEmployeeType($new_type)
{
$this->addContactType($new_type, 'employee');
}
public function addContactType($new_type, $index)
{
$types = explode(',', setting('contact.type.' . $index));