Prevent creating clients without contacts
This commit is contained in:
parent
80010880bb
commit
252c6f0a56
1 changed files with 3 additions and 1 deletions
|
|
@ -244,7 +244,9 @@ class Client extends EntityModel
|
|||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : (isset($data['id']) ? $data['id'] : false);
|
||||
|
||||
if ($publicId && $publicId != '-1') {
|
||||
// check if this client wasRecentlyCreated to ensure a new contact is
|
||||
// always created even if the request includes a contact id
|
||||
if (! $this->wasRecentlyCreated && $publicId && $publicId != '-1') {
|
||||
$contact = Contact::scope($publicId)->firstOrFail();
|
||||
} else {
|
||||
$contact = Contact::createNew();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue