mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-24 23:13:56 +00:00
update contact recode and clean up
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Classes\Modules\Contacts\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Contacts\Exceptions\CannotCreateContactException;
|
||||
use App\Models\Contact;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
|
||||
@@ -28,16 +29,22 @@ class CreatesContact
|
||||
*/
|
||||
public function execute(ContactObject $contact, int $type, int $referenceId)
|
||||
{
|
||||
$this->repository->type = $type;
|
||||
$this->repository->reference_id = $referenceId;
|
||||
$this->repository->name = $contact->getName();
|
||||
$this->repository->designation = $contact->getDesignation();
|
||||
$this->repository->email = $contact->getEmail();
|
||||
$this->repository->contact = $contact->getContact();
|
||||
try{
|
||||
|
||||
$this->repository->save();
|
||||
$this->repository->type = $type;
|
||||
$this->repository->reference_id = $Id;
|
||||
$this->repository->name = $contact->getName();
|
||||
$this->repository->designation = $contact->getDesignation();
|
||||
$this->repository->email = $contact->getEmail();
|
||||
$this->repository->contact = $contact->getContact();
|
||||
$this->repository->save();
|
||||
return $this->repository;
|
||||
}
|
||||
catch (\Exception $exception)
|
||||
{
|
||||
throw new CannotCreateContactException($exception->getMessage());
|
||||
}
|
||||
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user