Set contact types (customer/vendor)
This commit is contained in:
parent
f60b34d668
commit
46f8c44fff
@ -17,4 +17,29 @@ trait Contacts
|
|||||||
|
|
||||||
return ($return == 'array') ? explode(',', $types) : $types;
|
return ($return == 'array') ? explode(',', $types) : $types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCustomerType($new_type)
|
||||||
|
{
|
||||||
|
$this->setType($new_type, 'customer');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVendorType($new_type)
|
||||||
|
{
|
||||||
|
$this->setType($new_type, 'vendor');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setType($new_type, $index)
|
||||||
|
{
|
||||||
|
$types = explode(',', setting('contact.type.' . $index, $index));
|
||||||
|
|
||||||
|
if (in_array($new_type, $types)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$types[] = $new_type;
|
||||||
|
|
||||||
|
setting([
|
||||||
|
'contact.type.' . $index => implode(',', $types),
|
||||||
|
])->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user