mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Contacts\Processors;
|
|
|
|
|
|
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
|
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
|
use App\Classes\Modules\Contacts\Standards\Rules\CanCreateContact;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CreateContactProcessor
|
|
{
|
|
/** @var CanCreateContact */
|
|
private $canCreateContact;
|
|
|
|
/** @var CreatesContact */
|
|
private $createsContact;
|
|
|
|
/**
|
|
* CreateContactControllerLogic constructor.
|
|
* @param CanCreateContact $canCreateContact
|
|
* @param CreatesContact $createsContact
|
|
*/
|
|
public function __construct(CanCreateContact $canCreateContact, CreatesContact $createsContact)
|
|
{
|
|
$this->canCreateContact = $canCreateContact;
|
|
$this->createsContact = $createsContact;
|
|
}
|
|
|
|
/**
|
|
* @param Request $request
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
|
* @throws \App\Classes\Exceptions\MalformedRequestException
|
|
* @throws \App\Classes\Exceptions\RequestValidationException
|
|
*/
|
|
public function execute(Request $request){
|
|
$object = new ContactObject($request->input('company_id'), $request->input('name'), $request->input('designation'), $request->input('email'), $request->input('phone'), $request->input('wechat_id'));
|
|
|
|
$this->canCreateContact->passes($object);
|
|
|
|
return $this->createsContact->execute($object);
|
|
}
|
|
|
|
} |